From eced57ccb631827e099ad6906201a51e09c818bc Mon Sep 17 00:00:00 2001 From: w-mj Date: Mon, 13 Mar 2023 22:12:56 +0800 Subject: [PATCH] log on get files --- Makefile | 2 +- src/persistent_file_manager.go | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3094bc6..a0da196 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TAG ?= v1.1.14 +TAG ?= v1.1.16 IMAGE_TAG ?= docker.educg.net/cg/k8s-manager:$(TAG) build: export CGO_ENABLED=0 diff --git a/src/persistent_file_manager.go b/src/persistent_file_manager.go index a8e1e15..2f1c66d 100644 --- a/src/persistent_file_manager.go +++ b/src/persistent_file_manager.go @@ -3,8 +3,6 @@ package k8s_manager import ( "github.com/gin-gonic/gin" log "github.com/sirupsen/logrus" - "github.com/thoas/go-funk" - "io/fs" "net/http" "os" "path" @@ -22,7 +20,12 @@ func GetFiles(c *gin.Context) { return } } - c.JSON(http.StatusOK, gin.H{"ok": true, "files": funk.Map(dir, func(d fs.DirEntry) string { return d.Name() }).([]string)}) + log.Info(dir) + ans := make([]string, len(dir)) + for i, d := range dir { + ans[i] = d.Name() + } + c.JSON(http.StatusOK, gin.H{"ok": true, "files": ans}) } func GetPostOrDeleteFile(c *gin.Context) {