From c62ef882346cd2274dbab9321dd77bb4c376523f Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Tue, 2 Jul 2024 18:03:08 +0100 Subject: [PATCH] remove statik (#3762) Signed-off-by: Chris Martin Co-authored-by: Chris Martin --- go.mod | 1 - go.sum | 2 -- internal/common/database/migrations.go | 46 -------------------------- 3 files changed, 49 deletions(-) diff --git a/go.mod b/go.mod index c67881c9d49..c03c249b2c5 100644 --- a/go.mod +++ b/go.mod @@ -38,7 +38,6 @@ require ( github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.17.0 - github.com/rakyll/statik v0.1.7 github.com/renstrom/shortuuid v3.0.0+incompatible github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.8.0 diff --git a/go.sum b/go.sum index 150504c7265..ca765fd3121 100644 --- a/go.sum +++ b/go.sum @@ -472,8 +472,6 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY= github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/redis/go-redis/extra/redisprometheus/v9 v9.0.5 h1:kvl0LOTQD23VR1R7A9vDti9msfV6mOE2+j6ngYkFsfg= github.com/redis/go-redis/extra/redisprometheus/v9 v9.0.5/go.mod h1:VhyLk7MdSTKbJCx6+wXlj3/ebh49gTq3yBiXymYrG7w= github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8= diff --git a/internal/common/database/migrations.go b/internal/common/database/migrations.go index b8f285d0605..3670fc07e8b 100644 --- a/internal/common/database/migrations.go +++ b/internal/common/database/migrations.go @@ -1,15 +1,12 @@ package database import ( - "bytes" "io/fs" "path" "sort" "strconv" "strings" - stakikfs "github.com/rakyll/statik/fs" - "github.com/armadaproject/armada/internal/common/armadacontext" ) @@ -120,46 +117,3 @@ func ReadMigrations(fsys fs.FS, basePath string) ([]Migration, error) { } return migrations, nil } - -// TODO: remove this when we've migrated over to iofs -func ReadMigrationsFromStatik(namespace string) ([]Migration, error) { - vfs, err := stakikfs.NewWithNamespace(namespace) - if err != nil { - return nil, err - } - - dir, err := vfs.Open("/") - if err != nil { - return nil, err - } - - files, err := dir.Readdir(-1) - if err != nil { - return nil, err - } - - sort.Slice(files, func(i, j int) bool { return files[i].Name() < files[j].Name() }) - - var migrations []Migration - for _, f := range files { - file, err := vfs.Open("/" + f.Name()) - if err != nil { - return nil, err - } - buf := new(bytes.Buffer) - _, err = buf.ReadFrom(file) - if err != nil { - return nil, err - } - id, err := strconv.Atoi(strings.Split(f.Name(), "_")[0]) - if err != nil { - return nil, err - } - migrations = append(migrations, Migration{ - id: id, - name: f.Name(), - sql: buf.String(), - }) - } - return migrations, nil -}