Giter Site home page Giter Site logo

Comments (12)

wader avatar wader commented on August 25, 2024 1

@mpanczyk aha sorry! thought you might be the maintainer of this package https://pkgs.alpinelinux.org/package/edge/testing/x86_64/fq

from fq.

wader avatar wader commented on August 25, 2024 1

gojq does this by keeping the latest released in a go file https://github.com/itchyny/gojq/blob/main/cli/cli.go#L19 and also has a "revision" variable set to "HEAD" by default and is changed it building via make. Feel like a good solution i think.

from fq.

mpolanski avatar mpolanski commented on August 25, 2024 1

This is now fixed on Alpine via alpinelinux/aports@1974aa4. I don't think that you need to change how the version string is set. A lot of software use goreleaser and pass some flags using ldflags. It's nothing wrong with that.

from fq.

wader avatar wader commented on August 25, 2024 1

@danfe @mpanczyk Hey, just published version 0.0.4 and it embeds the version so build flags is not needed anymore.

from fq.

Doctor-love avatar Doctor-love commented on August 25, 2024

Hmm, there is no way to include this information using standard "go build"?

from fq.

wader avatar wader commented on August 25, 2024

There is but not automatically, in go 1.18 go build will start to include some VCS information automatically i think. But that wont help for source archive builds. For binaries I currently i use goreleaser to pass go build flags to set the variable main.version.

I see that the nix builds sets verison https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/tools/fq/default.nix#L24
but alpine does not https://git.alpinelinux.org/aports/tree/testing/fq/APKBUILD

I don't really follow how nix, alpine etc downloads the source, clones a git tag or downloads release archive?

I'll think and investigate a bit more, maybe can make goreleaser generate a version file while arching? but feels a bit ugly

from fq.

wader avatar wader commented on August 25, 2024

@mpanczyk hey, what do you think about this?

from fq.

mpanczyk avatar mpanczyk commented on August 25, 2024

@wader Sorry, but I think you have me confused with someone else.

from fq.

wader avatar wader commented on August 25, 2024

@mpolanski 👍 ill let you know if i switch to baking the version number into the source somehow, might be nice for ppl who build from source archives

from fq.

wader avatar wader commented on August 25, 2024

@danfe Looking at the freebsd ports Makefile i guess it also shows "dev" as version? if so, any preference to how to fix?

from fq.

danfe avatar danfe commented on August 25, 2024

Looking at the FreeBSD ports Makefile I guess it also shows dev as version?

That's right, it does show dev when running fq --version.

If so, any preference to how to fix?

This is one of those things we lost upon entering modern era which replaced traditional, properly bootstrapped and $version expanded release tarballs with git tags (git does not even support keyword expansion which makes it even harder). Archived sources from GitHub (which packagers download, it's not the same as compressed git clone) do not contain any git metadata, so there's nowhere to derive version from (ditto for the commit hash). I personally simply edit files with sed(1) to fill in correct values prior to building. I can't think of an elegant solution (with git) other than generating proper release tarball like in the old times.

from fq.

wader avatar wader commented on August 25, 2024

This is one of those things we lost upon entering modern era which replaced traditional, properly bootstrapped and $version expanded release tarballs with git tags (git does not even support keyword expansion which makes it even harder). Archived sources from GitHub (which packagers download, it's not the same as compressed git clone) do not contain any git metadata, so there's nowhere to derive version from (ditto for the commit hash). I personally simply edit files with sed(1) to fill in correct values prior to building. I can't think of an elegant solution (with git) other than generating proper release tarball like in the old times.

Yeah i think your right. I will probably keep the latest release version in a file somehow. Also noticed now that goreleaser (a go release tool) seems to not produce source archives on it own, instead links to archive tags somehow, should look into that.

Thanks for your thoughts

from fq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.