sshcode icon indicating copy to clipboard operation
sshcode copied to clipboard

`sshcode --version` does not print version info

Open samuela opened this issue 5 years ago • 12 comments
trafficstars

I installed sshcode via go get -u go.coder.com/sshcode, and when I run sshcode --version I don't get any version info:

pi@raspberrypi:~ $ sshcode --version

pi@raspberrypi:~ $ 

samuela avatar Nov 26 '19 20:11 samuela

Confirming this on Debian Linux, using sshcode built from source.

fonnesbeck avatar Dec 19 '19 15:12 fonnesbeck

this is probably because those don't have release info?

But can confirm this does happen on termux, Android 8.1

On Thu, Dec 19, 2019, 7:50 AM Chris Fonnesbeck [email protected] wrote:

Confirming this on Debian Linux, using sshcode built from source.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/cdr/sshcode/issues/154?email_source=notifications&email_token=ACPQOXSE4DXXLZ7CTYISSGTQZOJ23A5CNFSM4JR5QA32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHKBA3I#issuecomment-567545965, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPQOXRBVR2SGMJXSZTXKY3QZOJ23ANCNFSM4JR5QA3Q .

Merith-TK avatar Dec 19 '19 15:12 Merith-TK

Yeah this is an issue with fetching sshcode using go get instead of downloading a release binary. Since we're not running ci/build.sh the version information is never set. Off the top of my head I don't think there's an easy way to make this fill in automatically when running go get and the obvious intention is to not have to update the version manually... I wonder if instead of printing an empty string it should just say something like unofficial?

IngCr3at1on avatar Dec 27 '19 17:12 IngCr3at1on

Maybe git version?

Merith-TK avatar Dec 27 '19 18:12 Merith-TK

How do you get the git version without a script? There's no way (to my knowledge) to get such a value using go get to build the binary.

IngCr3at1on avatar Dec 27 '19 19:12 IngCr3at1on

uhm, check the git version of GOPATH/src/github.com/cdr/sshcode?

Merith-TK avatar Dec 27 '19 19:12 Merith-TK

The issue is that running go get -u go.coder.com/sshcode is leveraging the go tooling, it sees the presence of a main.go and compiles this to a binary. There's no way to make that tooling find the version and add it to the version string. The string value itself is set at compile-time using a ldflag which you otherwise don't get to pass in when running go get.

That's why it's blank currently, the string has no default value and nothing is being set using a ldflag. My suggestion above was to set a default value that would be overwritten by the script for official builds.

IngCr3at1on avatar Dec 27 '19 19:12 IngCr3at1on

If you're installing from source there's no release version built into the binary. I don't think it's a big deal that it prints nothing in this case, but I'll accept a PR so custom builds say unofficial.

deansheather avatar Feb 21 '20 07:02 deansheather

If you're installing from source there's no release version built into the binary. I don't think it's a big deal that it prints nothing in this case, but I'll accept a PR so custom builds say unofficial.

Yeah personally I'm totally indifferent my comments and suggestions here were just to other's benefit. That said if it's wanted by others I'll gladly submit such a PR, another option might be to simply link this issue from a FAQ in the readme, or yes leave it entirely as is as it's a pretty small non-annoyance :smile:

IngCr3at1on avatar Mar 12 '20 22:03 IngCr3at1on

One way to build with git versions is to use a script to sed a go file that contained a variable? Contents would be

package main const version = "Version/commit string"

On Thu, Mar 12, 2020, 3:36 PM Nathan Bass [email protected] wrote:

If you're installing from source there's no release version built into the binary. I don't think it's a big deal that it prints nothing in this case, but I'll accept a PR so custom builds say unofficial.

Yeah personally I'm totally indifferent my comments and suggestions here were just to other's benefit. That said if it's wanted by others I'll gladly submit such a PR, another option might be to simply link this issue from a FAQ in the readme, or yes leave it entirely as is as it's a pretty small non-annoyance 😄

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cdr/sshcode/issues/154#issuecomment-598462276, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPQOXTOOMUMBFKJBO2ZWCTRHFPVHANCNFSM4JR5QA3Q .

Merith-TK avatar Mar 13 '20 17:03 Merith-TK

One way to build with git versions is to use a script to sed a go file that contained a variable? Contents would be package main const version = "Version/commit string"

The problem is that script will never be called by go get which is always going to be the preferred method for installing a go binary directly from source.

IngCr3at1on avatar Mar 13 '20 17:03 IngCr3at1on

Ah, yeah, go really needs to get make file support, like just run make go if go exists in the make file. And it would be steps done before "go build"

On Fri, Mar 13, 2020, 10:23 AM Nathan Bass [email protected] wrote:

One way to build with git versions is to use a script to sed a go file that contained a variable? Contents would be package main const version = "Version/commit string"

The problem is that script will never be called by go get which is always going to be the preferred method for installing a go binary directly from source.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/cdr/sshcode/issues/154#issuecomment-598831133, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACPQOXXEKIWXHZKJWDBU4BDRHJTZBANCNFSM4JR5QA3Q .

Merith-TK avatar Mar 13 '20 17:03 Merith-TK