aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 15:53:53 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-03 15:53:53 +0200
commit40f7f691d4143c7be4dc72babb2b5288cbfef45c (patch)
tree34bd8c439035a55336e4a5b06145033d282888e7
parent416be8872c0066a84a3e03622bb3dbb7c5544eea (diff)
downloadfeed2imap-go-40f7f691d4143c7be4dc72babb2b5288cbfef45c.tar.gz
feed2imap-go-40f7f691d4143c7be4dc72babb2b5288cbfef45c.tar.bz2
feed2imap-go-40f7f691d4143c7be4dc72babb2b5288cbfef45c.zip
Explicit version info
Diffstat (limited to '')
-rw-r--r--internal/feed/mail.go3
-rw-r--r--main.go3
-rw-r--r--pkg/config/config.go10
-rw-r--r--pkg/version/version.go11
4 files changed, 15 insertions, 12 deletions
diff --git a/internal/feed/mail.go b/internal/feed/mail.go
index 290c965..2b0cdf7 100644
--- a/internal/feed/mail.go
+++ b/internal/feed/mail.go
@@ -20,6 +20,7 @@ import (
"github.com/Necoro/feed2imap-go/internal/msg"
"github.com/Necoro/feed2imap-go/pkg/config"
"github.com/Necoro/feed2imap-go/pkg/log"
+ "github.com/Necoro/feed2imap-go/pkg/version"
)
func address(name, address string) []*mail.Address {
@@ -54,7 +55,7 @@ func (item *item) buildHeader() message.Header {
h.SetContentType("multipart/alternative", nil)
h.SetAddressList("From", item.fromAddress())
h.SetAddressList("To", item.toAddress())
- h.Set(msg.VersionHeader, config.Version())
+ h.Set(msg.VersionHeader, version.Version())
h.Set(msg.ReasonHeader, strings.Join(item.reasons, ","))
h.Set(msg.IdHeader, item.id())
h.Set("Message-Id", item.messageId())
diff --git a/main.go b/main.go
index 074c14b..b959076 100644
--- a/main.go
+++ b/main.go
@@ -10,6 +10,7 @@ import (
"github.com/Necoro/feed2imap-go/internal/imap"
"github.com/Necoro/feed2imap-go/pkg/config"
"github.com/Necoro/feed2imap-go/pkg/log"
+ "github.com/Necoro/feed2imap-go/pkg/version"
)
var printVersion = flag.Bool("version", false, "print version and exit")
@@ -51,7 +52,7 @@ func processFeed(feed *feed.Feed, client *imap.Client, dryRun bool) {
func run() error {
flag.Parse()
if *printVersion {
- println("Feed2Imap-Go, version " + config.Version())
+ println("Feed2Imap-Go, version " + version.Version())
return nil
}
diff --git a/pkg/config/config.go b/pkg/config/config.go
index eec2751..8d97a56 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -5,7 +5,6 @@ import (
"os"
"os/user"
"runtime"
- "runtime/debug"
"strings"
"github.com/Necoro/feed2imap-go/pkg/log"
@@ -95,15 +94,6 @@ func (opt GlobalOptions) WithPartHtml() bool {
return util.StrContains(opt.Parts, "html")
}
-// Current feed2imap version
-func Version() string {
- bi, ok := debug.ReadBuildInfo()
- if !ok {
- return "(unknown)"
- }
- return bi.Main.Version
-}
-
// Load configuration from file
func Load(path string) (*Config, error) {
log.Printf("Reading configuration file '%s'", path)
diff --git a/pkg/version/version.go b/pkg/version/version.go
new file mode 100644
index 0000000..81de2fc
--- /dev/null
+++ b/pkg/version/version.go
@@ -0,0 +1,11 @@
+package version
+
+// the way via debug.BuildInfo does not work -- it'll always return "devel"
+// thus the oldschool way: hardcoded
+
+const version = "0.1.0-devel"
+
+// Current feed2imap version
+func Version() string {
+ return version
+}