Hi Guys

Thank you for your response.

Consul is go executable. I can get version using /bin/consul version
command but I need to find the version using string search in executable
file data.


I noticed some pattern in executables

1.8.312345156252160h3100043191500ms781258760h94105:***@ => 1.8.3

1.8.212345156252160h3100043191500ms781258760h94105:***@ => 1.8.2

1.8.112345156252160h3100043191500ms781258760h94105:***@ => 1.8.1

1.8.012345156252160h3100043191500ms781258760h94105:***@

1.7.712345156252160h3100043191500ms781258760h94105:***@

1.7.612345156252160h3100043191500ms781258760h94105:***@

1.7.412345156252160h3100043191500ms781258760h94105:***@

1.7.312345156252160h3100043191500ms781258760h94105:***@

1.7.212345156252160h3100043191500ms781258760h94105:***@

1.6.812345156252160h3100043191500ms781258760h94105:***@


the first 3 digits are version number in above strings which we found them
executable but I don't find this string in all versions of consul


So does go use any specific delimiter before or after adding version
numbers in executable file (compiled file)?

do you have any idea to get version number from go executable without
executing it which is common for all?

Note: Attached screenshot method is not working for all versions



On Thu, Aug 13, 2020 at 6:35 PM Sathish VJ <sathis...@gmail.com> wrote:

> Maybe you are asking how to get build version information into the
> executable.  If yes, then use -ldflags.
> https://pmcgrath.net/include-version-information-in-golang-app
>
> On Thursday, 13 August 2020 at 15:12:36 UTC+5:30 seank...@gmail.com wrote:
>
>> go version -m <executable>
>>
>> On Thursday, August 13, 2020 at 10:30:56 AM UTC+2 santhoshth...@gmail.com
>> wrote:
>>
>>> Hi All,
>>>
>>> What is best way to know a executable version without executing it
>>> through golang?
>>>
>>> I tried with reading the executable file through a scanner and matching
>>> every line with regex (like ngnix regx) but this is not working for all
>>> executables.
>>>
>>> Do you have any idea?
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/eac6fad2-edcf-47c2-8b0e-e1f2d2dd6d56n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/eac6fad2-edcf-47c2-8b0e-e1f2d2dd6d56n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAN1Sb7wuBOxEFxO3KJnrDo9B6WuZcwCvnjsSHgZzKOMZ5OWO%3DQ%40mail.gmail.com.

Reply via email to