aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-04 18:01:23 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-04 18:01:23 +0200
commit11c8f1111c3f74ccc6bd4a3901f0eb447616f827 (patch)
treebcdfe945d7c50ee08a515a19aca9a5f3ddc5e171
parent5a169ab960333b28e3d0d6a72fc4bfaf67a00354 (diff)
downloadfeed2imap-go-11c8f1111c3f74ccc6bd4a3901f0eb447616f827.tar.gz
feed2imap-go-11c8f1111c3f74ccc6bd4a3901f0eb447616f827.tar.bz2
feed2imap-go-11c8f1111c3f74ccc6bd4a3901f0eb447616f827.zip
Build releases with goreleaser
-rw-r--r--.goreleaser.yml33
-rw-r--r--main.go2
-rw-r--r--pkg/version/version.go15
3 files changed, 45 insertions, 5 deletions
diff --git a/.goreleaser.yml b/.goreleaser.yml
new file mode 100644
index 0000000..51ffd0d
--- /dev/null
+++ b/.goreleaser.yml
@@ -0,0 +1,33 @@
+project_name: feed2imap-go
+
+before:
+ hooks:
+ - go mod download
+builds:
+ -
+ binary: feed2imap-go
+ ldflags:
+ - -s -w -X github.com/Necoro/feed2imap-go/pkg/version.version={{.Version}} -X github.com/Necoro/feed2imap-go/pkg/version.commit={{.ShortCommit}}
+ goos:
+ - windows
+ - linux
+ - darwin
+ goarch:
+ - amd64
+archives:
+ -
+ replacements:
+ amd64: x86_64
+ 386: x86_32
+
+ format: tar.gz
+ format_overrides:
+ - goos: windows
+ format: zip
+ files:
+ - LICENSE
+ - README.md
+ - config.yml.example
+
+changelog:
+ skip: true
diff --git a/main.go b/main.go
index b959076..4dce1b7 100644
--- a/main.go
+++ b/main.go
@@ -52,7 +52,7 @@ func processFeed(feed *feed.Feed, client *imap.Client, dryRun bool) {
func run() error {
flag.Parse()
if *printVersion {
- println("Feed2Imap-Go, version " + version.Version())
+ println("Feed2Imap-Go, " + version.FullVersion())
return nil
}
diff --git a/pkg/version/version.go b/pkg/version/version.go
index 5e224a6..eabf583 100644
--- a/pkg/version/version.go
+++ b/pkg/version/version.go
@@ -1,11 +1,18 @@
package version
-// the way via debug.BuildInfo does not work -- it'll always return "devel"
-// thus the oldschool way: hardcoded
+// this is set by the linker during build
+var (
+ version = "devel"
+ commit = ""
-const version = "0.2.0-devel"
+)
-// Current feed2imap version
+// Version returns the current feed2imap-go version
func Version() string {
return version
}
+
+// FullVersion returns the version including the commit hash
+func FullVersion() string {
+ return "Version " + version + " Commit: " + commit
+} \ No newline at end of file