From 9afe211d90bb803a702f575e41184a216027d70b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiger=20Wang=20=28=E7=8E=8B=E8=B1=AB=29?= Date: Wed, 31 Aug 2022 00:29:50 -0400 Subject: [PATCH] fix migration from 0.3.5.1 (#10) --- .../script.d/02-migrate-user-service.sh | 34 +++++++++--- .../service.d/user-service/migration.list | 5 +- cmd/migration-tool/main.go | 11 ++-- cmd/migration-tool/migration_032_and_older.go | 23 ++++++-- cmd/migration-tool/migration_033_034_035.go | 53 ++++++++++++++++--- go.mod | 14 ++++- go.sum | 33 ++++++++++-- main.go | 2 +- 8 files changed, 146 insertions(+), 29 deletions(-) diff --git a/build/scripts/migration/script.d/02-migrate-user-service.sh b/build/scripts/migration/script.d/02-migrate-user-service.sh index 629f4c3..3e95f2a 100644 --- a/build/scripts/migration/script.d/02-migrate-user-service.sh +++ b/build/scripts/migration/script.d/02-migrate-user-service.sh @@ -20,6 +20,17 @@ __error() { exit 1 } +__normalize_version() { + local version + if [ "${1::1}" = "v" ]; then + version="${1:1}" + else + version="${1}" + fi + + echo "$version" +} + __is_version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1" } @@ -28,8 +39,8 @@ __is_migration_needed() { local version1 local version2 - version1="${1}" - version2="${2}" + version1=$(__normalize_version "${1}") + version2=$(__normalize_version "${2}") if [ "${version1}" = "${version2}" ]; then return 1 @@ -76,7 +87,12 @@ if [ "${NEED_MIGRATION}" = "false" ]; then exit 0 fi -MIGRATION_SERVICE_DIR=${BUILD_PATH}/scripts/migration/service.d/${APP_NAME_SHORT} +MIGRATION_SERVICE_DIR=${1} + +if [ -z "${MIGRATION_SERVICE_DIR}" ]; then + MIGRATION_SERVICE_DIR=${BUILD_PATH}/scripts/migration/service.d/${APP_NAME_SHORT} +fi + MIGRATION_LIST_FILE=${MIGRATION_SERVICE_DIR}/migration.list MIGRATION_PATH=() @@ -97,7 +113,7 @@ while read -r VERSION_PAIR; do # obtain "v0.3.6-alpha2" from "v0.3.5 v0.3.6-alpha2" VER2=$(echo "${VERSION_PAIR}" | cut -d' ' -f2) - if [ "v${CURRENT_VERSION}" = "${VER1// /}" ] || [ "${CURRENT_VERSION}" = "LEGACY_WITHOUT_VERSION" ]; then + if [ "${CURRENT_VERSION}" = "${VER1// /}" ] || [ "${CURRENT_VERSION}" = "LEGACY_WITHOUT_VERSION" ]; then CURRENT_VERSION_FOUND="true" fi @@ -132,6 +148,13 @@ pushd "${MIGRATION_SERVICE_DIR}" { for VER2 in "${MIGRATION_PATH[@]}"; do + MIGRATION_TOOL_FILE=linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz + + if [ -f "${MIGRATION_TOOL_FILE}" ]; then + __info "Migration tool ${MIGRATION_TOOL_FILE} exists. Skip downloading." + continue + fi + MIGRATION_TOOL_URL=https://github.com/IceWhaleTech/"${APP_NAME_FORMAL}"/releases/download/"${VER2}"/linux-"${ARCH}"-"${APP_NAME}"-migration-tool-"${VER2}".tar.gz __info "Dowloading ${MIGRATION_TOOL_URL}..." curl -sL -O "${MIGRATION_TOOL_URL}" @@ -147,9 +170,6 @@ pushd "${MIGRATION_SERVICE_DIR}" __info "Extracting ${MIGRATION_TOOL_FILE}..." tar zxvf "${MIGRATION_TOOL_FILE}" || __error "Failed to extract ${MIGRATION_TOOL_FILE}" - MIGRATION_SYSROOT_DIR=$(realpath -e "${MIGRATION_SERVICE_DIR}"/build/sysroot || __error "Failed to find sysroot directory for migration") - cp -rv "${MIGRATION_SYSROOT_DIR}"/* / || __error "Failed to copy sysroot directory for migration" - MIGRATION_TOOL_PATH=build/sysroot/usr/bin/${APP_NAME}-migration-tool __info "Running ${MIGRATION_TOOL_PATH}..." ${MIGRATION_TOOL_PATH} diff --git a/build/scripts/migration/service.d/user-service/migration.list b/build/scripts/migration/service.d/user-service/migration.list index 9f0512d..2867263 100644 --- a/build/scripts/migration/service.d/user-service/migration.list +++ b/build/scripts/migration/service.d/user-service/migration.list @@ -1,2 +1,3 @@ -LEGACY_WITHOUT_VERSION v0.3.6-alpha4 -v0.3.5 v0.3.6-alpha4 +LEGACY_WITHOUT_VERSION v0.3.6-alpha5 +v0.3.5 v0.3.6-alpha5 +v0.3.5.1 v0.3.6-alpha5 diff --git a/cmd/migration-tool/main.go b/cmd/migration-tool/main.go index 3e9271e..d0f3bd0 100644 --- a/cmd/migration-tool/main.go +++ b/cmd/migration-tool/main.go @@ -1,6 +1,7 @@ package main import ( + _ "embed" "flag" "fmt" "os" @@ -11,10 +12,14 @@ import ( ) const ( - userServiceConfigSampleFilePath = "/etc/casaos/user-service.conf.sample" - userServiceName = "casaos-user-service.service" + userServiceConfigDirPath = "/etc/casaos" + userServiceConfigFilePath = "/etc/casaos/user-service.conf" + userServiceName = "casaos-user-service.service" ) +//go:embedded ../../build/sysroot/etc/casaos/user-service.conf.sample +var _userServiceConfigFileSample string + var _logger *Logger func main() { @@ -24,7 +29,7 @@ func main() { flag.Parse() if *versionFlag { - fmt.Println(common.Version) + fmt.Printf("v%s\n", common.Version) os.Exit(0) } diff --git a/cmd/migration-tool/migration_032_and_older.go b/cmd/migration-tool/migration_032_and_older.go index 3136cf9..be27a5b 100644 --- a/cmd/migration-tool/migration_032_and_older.go +++ b/cmd/migration-tool/migration_032_and_older.go @@ -53,9 +53,26 @@ func (u *migrationTool1) IsMigrationNeeded() (bool, error) { } func (u *migrationTool1) PreMigrate() error { - _logger.Info("Copying %s to %s if it doesn't exist...", userServiceConfigSampleFilePath, config.UserServiceConfigFilePath) - if err := file.CopySingleFile(userServiceConfigSampleFilePath, config.UserServiceConfigFilePath, "skip"); err != nil { - return err + if _, err := os.Stat(userServiceConfigDirPath); os.IsNotExist(err) { + _logger.Info("Creating %s since it doesn't exists...", userServiceConfigDirPath) + if err := os.Mkdir(userServiceConfigDirPath, 0o755); err != nil { + return err + } + } + + if _, err := os.Stat(userServiceConfigFilePath); os.IsNotExist(err) { + _logger.Info("Creating %s since it doesn't exist...", userServiceConfigFilePath) + + f, err := os.Create(userServiceConfigFilePath) + if err != nil { + return err + } + + defer f.Close() + + if _, err := f.WriteString(_userServiceConfigFileSample); err != nil { + return err + } } extension := "." + time.Now().Format("20060102") + ".bak" diff --git a/cmd/migration-tool/migration_033_034_035.go b/cmd/migration-tool/migration_033_034_035.go index 97bf9bb..e096767 100644 --- a/cmd/migration-tool/migration_033_034_035.go +++ b/cmd/migration-tool/migration_033_034_035.go @@ -16,6 +16,8 @@ import ( "gopkg.in/ini.v1" ) +const defaultDBPath = "/var/lib/casaos" + type migrationTool2 struct{} func (u *migrationTool2) IsMigrationNeeded() (bool, error) { @@ -51,9 +53,26 @@ func (u *migrationTool2) IsMigrationNeeded() (bool, error) { } func (u *migrationTool2) PreMigrate() error { - _logger.Info("Copying %s to %s if it doesn't exist...", userServiceConfigSampleFilePath, config.UserServiceConfigFilePath) - if err := file.CopySingleFile(userServiceConfigSampleFilePath, config.UserServiceConfigFilePath, "skip"); err != nil { - return err + if _, err := os.Stat(userServiceConfigDirPath); os.IsNotExist(err) { + _logger.Info("Creating %s since it doesn't exists...", userServiceConfigDirPath) + if err := os.Mkdir(userServiceConfigDirPath, 0o755); err != nil { + return err + } + } + + if _, err := os.Stat(userServiceConfigFilePath); os.IsNotExist(err) { + _logger.Info("Creating %s since it doesn't exist...", userServiceConfigFilePath) + + f, err := os.Create(userServiceConfigFilePath) + if err != nil { + return err + } + + defer f.Close() + + if _, err := f.WriteString(_userServiceConfigFileSample); err != nil { + return err + } } extension := "." + time.Now().Format("20060102") + ".bak" @@ -72,6 +91,14 @@ func (u *migrationTool2) PreMigrate() error { dbFile := filepath.Join(dbPath, "db", "casaOS.db") + if _, err := os.Stat(dbFile); err != nil { + dbFile = filepath.Join(defaultDBPath, "db", "casaOS.db") + + if _, err := os.Stat(dbFile); err != nil { + return err + } + } + _logger.Info("Creating a backup %s if it doesn't exist...", dbFile+extension) if err := file.CopySingleFile(dbFile, dbFile+extension, "skip"); err != nil { return err @@ -103,7 +130,11 @@ func (u *migrationTool2) PostMigrate() error { dbFile := filepath.Join(dbPath, "db", "casaOS.db") if _, err := os.Stat(dbFile); err != nil { - return err + dbFile = filepath.Join(defaultDBPath, "db", "casaOS.db") + + if _, err := os.Stat(dbFile); err != nil { + return err + } } legacyDB, err := sql.Open("sqlite3", dbFile) @@ -122,7 +153,12 @@ func (u *migrationTool2) PostMigrate() error { _logger.Error("Failed to drop `o_users` table in legacy database: %s", err) } } - return nil + + _logger.Info("Deleting legacy `user` section in %s...", version.LegacyCasaOSConfigFilePath) + + legacyConfigFile.DeleteSection("user") + + return legacyConfigFile.SaveTo(version.LegacyCasaOSConfigFilePath) } func NewMigrationToolFor033_034_035() interfaces.MigrationTool { @@ -171,9 +207,12 @@ func migrateUser2(legacyConfigFile *ini.File) error { dbFile := filepath.Join(dbPath, "db", "casaOS.db") if _, err := os.Stat(dbFile); err != nil { - return err - } + dbFile = filepath.Join(defaultDBPath, "db", "casaOS.db") + if _, err := os.Stat(dbFile); err != nil { + return err + } + } legacyDB, err := sql.Open("sqlite3", dbFile) if err != nil { return err diff --git a/go.mod b/go.mod index 74619a2..af1b0a6 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/IceWhaleTech/CasaOS-UserService go 1.19 require ( - github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220830042034-a4df79c84ce6 - github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha4 + github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220831042533-e51a41247ea2 + github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha5 github.com/gin-contrib/gzip v0.0.6 github.com/gin-gonic/gin v1.8.1 github.com/satori/go.uuid v1.2.0 @@ -16,8 +16,10 @@ require ( ) require ( + github.com/andybalholm/brotli v1.0.1 // indirect github.com/benbjohnson/clock v1.3.0 // indirect github.com/coreos/go-systemd/v22 v22.3.2 // indirect + github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 // indirect github.com/fsnotify/fsnotify v1.5.4 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.0 // indirect @@ -26,19 +28,25 @@ require ( github.com/goccy/go-json v0.9.10 // indirect github.com/godbus/dbus/v5 v5.0.4 // indirect github.com/golang-jwt/jwt/v4 v4.4.2 // indirect + github.com/golang/snappy v0.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.13.6 // indirect + github.com/klauspost/pgzip v1.2.5 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/magiconair/properties v1.8.6 // indirect github.com/mattn/go-isatty v0.0.14 // indirect github.com/mattn/go-sqlite3 v1.14.14 // indirect + github.com/mholt/archiver/v3 v3.5.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/nwaples/rardecode v1.1.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.2 // indirect + github.com/pierrec/lz4/v4 v4.1.2 // indirect github.com/spf13/afero v1.8.2 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect @@ -48,6 +56,8 @@ require ( github.com/tidwall/match v1.1.1 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/ugorji/go/codec v1.2.7 // indirect + github.com/ulikunitz/xz v0.5.9 // indirect + github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect go.uber.org/atomic v1.9.0 // indirect go.uber.org/multierr v1.8.0 // indirect golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa // indirect diff --git a/go.sum b/go.sum index 2d22d6d..f8b8d87 100644 --- a/go.sum +++ b/go.sum @@ -39,10 +39,12 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7 github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v1.2.0 h1:Rt8g24XnyGTyglgET/PRUNlrUeu9F5L+7FilkXfZgs0= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220830042034-a4df79c84ce6 h1:ICitt/XvD1oh3BTdQbzV95G48TFY/aiZr55iA8dMD8M= -github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220830042034-a4df79c84ce6/go.mod h1:5sqNKg5cEH7IUnCklLSTrVoGx1dMBhm9DFDsCYVPvPQ= -github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha4 h1:fSlA5kNBS/Q4D6bFWiNZTwUfsYQ5F/78vJLvUoowXao= -github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha4/go.mod h1:8E5T8HJn2OUXz+KBZRD84CzwhBdCWsIBuQChZJ7XDwE= +github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220831042533-e51a41247ea2 h1:l/f2wj7Xs1nbdhbio3ENzPT2cHuFIXuAhptqIIfndrg= +github.com/IceWhaleTech/CasaOS-Common v0.0.0-20220831042533-e51a41247ea2/go.mod h1:5sqNKg5cEH7IUnCklLSTrVoGx1dMBhm9DFDsCYVPvPQ= +github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha5 h1:aRDy7ug77eZN19vqRjH1N6HHYuzYUnwp9ByMwdfnmJw= +github.com/IceWhaleTech/CasaOS-Gateway v0.3.6-alpha5/go.mod h1:v2d+VlVMF6i0XPGRJbmUt1b270J8kn1+pV5xmCJFrXk= +github.com/andybalholm/brotli v1.0.1 h1:KqhlKozYbRtJvsPrrEeXcO+N2l6NYT5A2QAFmSULpEc= +github.com/andybalholm/brotli v1.0.1/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= @@ -60,6 +62,9 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ3 github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5 h1:iFaUwBSo5Svw6L7HYpRu/0lE3e0BaElwnNO1qkNQxBY= +github.com/dsnet/compress v0.0.2-0.20210315054119-f66993602bf5/go.mod h1:qssHWj60/X5sZFNxpG4HBPDHVqxNm4DfnCKgrbZOT+s= +github.com/dsnet/golib v0.0.0-20171103203638-1ea166775780/go.mod h1:Lj+Z9rebOhdfkVLjJ8T6VcRQv3SXugXy999NBtR9aFY= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= @@ -120,6 +125,8 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/snappy v0.0.2 h1:aeE13tS0IiQgFjYdoL8qN3K1N2bXXtI6Vi51/y7BpMw= +github.com/golang/snappy v0.0.2/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -168,6 +175,13 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= +github.com/klauspost/compress v1.11.4/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc= +github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= +github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/pgzip v1.2.5 h1:qnWYvvKqedOF2ulHpMG72XQol4ILEJ8k2wwRl/Km8oE= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -186,6 +200,8 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.14 h1:qZgc/Rwetq+MtyE18WhzjokPD93dNqLGNT3QJuLvBGw= github.com/mattn/go-sqlite3 v1.14.14/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= +github.com/mholt/archiver/v3 v3.5.1 h1:rDjOBX9JSF5BvoJGvjqK479aL70qh9DIpZCl+k7Clwo= +github.com/mholt/archiver/v3 v3.5.1/go.mod h1:e3dqJ7H78uzsRSEACH1joayhuSyhnonssnDhppzS1L4= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -193,11 +209,15 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/nwaples/rardecode v1.1.0 h1:vSxaY8vQhOcVr4mm5e8XllHWTiM4JF507A0Katqw7MQ= +github.com/nwaples/rardecode v1.1.0/go.mod h1:5DzqNKiOdpKKBH87u8VlvAnPZMXcGRhxWkRpHbbfGS0= github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/pelletier/go-toml/v2 v2.0.1/go.mod h1:r9LEWfGN8R5k0VXJ+0BkIe7MYkRdwZOjgMj2KwnJFUo= github.com/pelletier/go-toml/v2 v2.0.2 h1:+jQXlF3scKIcSEKkdHzXhCTDLPFi5r1wnK6yPS+49Gw= github.com/pelletier/go-toml/v2 v2.0.2/go.mod h1:MovirKjgVRESsAvNZlAjtFwV867yGuwRkXbG66OzopI= +github.com/pierrec/lz4/v4 v4.1.2 h1:qvY3YFXRQE/XB8MlLzJH7mSzBs74eA2gg52YTk6jUPM= +github.com/pierrec/lz4/v4 v4.1.2/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -245,6 +265,11 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= +github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.9 h1:RsKRIA2MO8x56wkkcd3LbtcE/uMszhb6DpRf+3uwa3I= +github.com/ulikunitz/xz v0.5.9/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofmx9yWTog9BfvIu0q41lo= +github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= diff --git a/main.go b/main.go index b179b77..f4d2257 100644 --- a/main.go +++ b/main.go @@ -33,7 +33,7 @@ func init() { flag.Parse() if *versionFlag { - fmt.Println(version) + fmt.Printf("v%s\n", common.Version) os.Exit(0) }