Skip to content

Commit ece4f47

Browse files
committed
Add FDW version property
1 parent 072edd0 commit ece4f47

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

fdw.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import (
1616
"time"
1717
"unsafe"
1818

19+
"github.com/turbot/steampipe-postgres-fdw/version"
20+
1921
"github.com/hashicorp/go-hclog"
2022
"github.com/turbot/steampipe-plugin-sdk/v3/logging"
2123
"github.com/turbot/steampipe-postgres-fdw/hub"
@@ -39,6 +41,7 @@ func init() {
3941
SetEnvVars()
4042

4143
level := logging.LogLevel()
44+
log.Printf("[INFO] Version v%s\n", version.FdwVersion.String())
4245
log.Printf("[INFO] Log level %s\n", level)
4346
if level != "TRACE" {
4447
// suppress logs

version/version.go

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// Package version :: The version package provides a location to set the release versions for all
2+
// packages to consume, without creating import cycles.
3+
//
4+
// This package should not import any other steampipe packages.
5+
//
6+
package version
7+
8+
import (
9+
"fmt"
10+
11+
"github.com/Masterminds/semver"
12+
)
13+
14+
// The main version number that is being run at the moment.
15+
var fdwVersion = "1.2.0"
16+
17+
// A pre-release marker for the version. If this is "" (empty string)
18+
// then it means that it is a final release. Otherwise, this is a pre-release
19+
// such as "dev" (in development), "beta", "rc1", etc.
20+
var prerelease = "rc.2"
21+
22+
// SteampipeVersion is an instance of semver.Version. This has the secondary
23+
// benefit of verifying during tests and init time that our version is a
24+
// proper semantic version, which should always be the case.
25+
var FdwVersion *semver.Version
26+
27+
var VersionString string
28+
29+
func init() {
30+
VersionString = fdwVersion
31+
if prerelease != "" {
32+
VersionString = fmt.Sprintf("%s-%s", fdwVersion, prerelease)
33+
}
34+
FdwVersion = semver.MustParse(VersionString)
35+
}

0 commit comments

Comments
 (0)