log on get files

This commit is contained in:
w-mj 2023-03-13 22:12:56 +08:00
parent 2c02bd4e09
commit eced57ccb6
No known key found for this signature in database
GPG Key ID: 3A2CB5BE2F835897
2 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
TAG ?= v1.1.14 TAG ?= v1.1.16
IMAGE_TAG ?= docker.educg.net/cg/k8s-manager:$(TAG) IMAGE_TAG ?= docker.educg.net/cg/k8s-manager:$(TAG)
build: export CGO_ENABLED=0 build: export CGO_ENABLED=0

View File

@ -3,8 +3,6 @@ package k8s_manager
import ( import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"github.com/thoas/go-funk"
"io/fs"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -22,7 +20,12 @@ func GetFiles(c *gin.Context) {
return 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) { func GetPostOrDeleteFile(c *gin.Context) {