File: version.go

package info (click to toggle)
dasel 2.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,844 kB
  • sloc: sh: 53; python: 21; makefile: 21; xml: 20
file content (28 lines) | stat: -rw-r--r-- 513 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package internal

import (
	"runtime/debug"
)

// Version represents the current version of dasel.
// The real version number is injected at build time using ldflags.
var Version = "development"

func init() {
	// Version is set by ldflags on build.
	if Version != "development" {
		return
	}

	info, ok := debug.ReadBuildInfo()
	if !ok {
		return
	}

	// https://github.com/golang/go/issues/29228
	if info.Main.Version == "(devel)" || info.Main.Version == "" {
		return
	}

	Version += "-" + info.Main.Version
}