Add version package and update the makefile
The makefile will grab the version info from git and pass it to the linker so that version information based on tags, commits and commit times is available in the code.
This commit is contained in:
1 parent
9acc9a03aa
commit
e66d800881
3 files changed
+32
-6
No files matched your search
@@ -14,9 +14,9 @@ import (
|
||||
"strconv"
|
||||
|
||||
_ "github.com/mattn/go-sqlite3"
|
||||
)
|
||||
|
||||
const expectedSchemaVersion = 1
|
||||
"git.omicron.one/omicron/linkshare/internal/version"
|
||||
)
|
||||
|
||||
// DB represents a database connection
|
||||
type DB struct {
|
||||
@@ -123,13 +123,13 @@ func (db *DB) CheckSchemaVersion() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
version, err := db.GetSchemaVersion()
|
||||
version_, err := db.GetSchemaVersion()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if version < expectedSchemaVersion {
|
||||
if version_ < version.SchemaVersion {
|
||||
return ErrSchemaOutdated
|
||||
} else if version > expectedSchemaVersion {
|
||||
} else if version_ > version.SchemaVersion {
|
||||
return ErrSchemaUnsupported
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user