Skip to content
This repository was archived by the owner on Jan 17, 2021. It is now read-only.
This repository was archived by the owner on Jan 17, 2021. It is now read-only.

sshcode --version does not print version info #154

Open

Description

@samuela

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:~ $ 

Activity

  1. fonnesbeck commented on Dec 19, 2019

    @fonnesbeck

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

  2. Merith-TK commented on Dec 19, 2019

    @Merith-TK
    Contributor
  3. IngCr3at1on commented on Dec 27, 2019

    @IngCr3at1on

    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?

  4. Merith-TK commented on Dec 27, 2019

    @Merith-TK
    Contributor

    Maybe git version?

  5. IngCr3at1on commented on Dec 27, 2019

    @IngCr3at1on

    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.

  6. Merith-TK commented on Dec 27, 2019

    @Merith-TK
    Contributor

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

  7. IngCr3at1on commented on Dec 27, 2019

    @IngCr3at1on

    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.

  8. deansheather commented on Feb 21, 2020

    @deansheather
    Collaborator

    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.

  9. IngCr3at1on commented on Mar 12, 2020

    @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.

    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 😄

  10. Merith-TK commented on Mar 13, 2020

    @Merith-TK
    Contributor
  11. IngCr3at1on commented on Mar 13, 2020

    @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"

    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.

  12. Merith-TK commented on Mar 13, 2020

    @Merith-TK
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions