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
cd0fb4edd2
commit
5145191c2b
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 {
|
||||
@@ -120,13 +120,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 ErrDatabaseSchemaOutdated
|
||||
} else if version > expectedSchemaVersion {
|
||||
} else if version_ > version.SchemaVersion {
|
||||
return ErrDatabaseSchemaUnsupported
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user