log on get files
This commit is contained in:
parent
2c02bd4e09
commit
eced57ccb6
2
Makefile
2
Makefile
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue