Skip to content

Commit

Permalink
Replace Version when building via Nix
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrenierejm committed Sep 4, 2023
1 parent 10ea3f2 commit 3b27f1a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import (
json "github.com/virtuald/go-ordered-json"
)

var version = "0.8.1"
var Version = "development"

// rootCmd represents the base command when called without any subcommands
var rootCmd = &cobra.Command{
Use: "gron",
Version: version,
Version: Version,
Short: "Transform JSON or YAML into discrete assignments to make it greppable",
Long: `gron transforms JSON or YAML (from a file, URL, or stdin) into discrete assignments to make it easier to grep for what you want and see the absolute "path" to it.
Expand Down
2 changes: 1 addition & 1 deletion cmd/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func getURL(url string, insecure bool) (io.Reader, error) {
if err != nil {
return nil, err
}
req.Header.Set("User-Agent", fmt.Sprintf("gron/%s", version))
req.Header.Set("User-Agent", fmt.Sprintf("gron/%s", Version))
req.Header.Set("Accept", "application/json")

resp, err := client.Do(req)
Expand Down
8 changes: 4 additions & 4 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
overlays = [ inputs.gomod2nix.overlays.default (final: prev: { }) ];
config = { };
};
version = inputs.self.shortRev or "development";
gron = pkgs.buildGoApplication {
inherit version;
pname = "gron";
version = self'.shortRev or "dirty";
# In 'nix develop', we don't need a copy of the source tree
# in the Nix store.
src = ./.;
ldflags = [ "-X github.com/lafrenierejm/gron/cmd.Version=${version}" ];
modules = ./gomod2nix.toml;
meta = with pkgs.lib; {
description =
Expand All @@ -50,7 +50,7 @@
# Per-system attributes can be defined here. The self' and inputs'
# module parameters provide easy access to attributes of the same
# system.
packages = rec {
packages = {
inherit gron;
default = gron;
};
Expand Down

0 comments on commit 3b27f1a

Please sign in to comment.