Sfoglia il codice sorgente

fix:修复环境问题

HeWang 13 ore fa
parent
commit
f7e0eba3f9
5 ha cambiato i file con 109 aggiunte e 118 eliminazioni
  1. 1 1
      deploy/plugin-compile_plugin-vaildate-build.sh
  2. 2 6
      go.mod
  3. 0 5
      go.sum
  4. 6 6
      test/oss_test.go
  5. 100 100
      test/zip_test.go

+ 1 - 1
deploy/plugin-compile_plugin-vaildate-build.sh

@@ -2,4 +2,4 @@
 
 # 插件编译接口
 go build -o ./deploy/exe/plugin-vaildate.exe ./tools/plugin-vaildate/main/main.go
-go build -o ./deploy/exe/plugin-compile.exe ./tools/plugin-compile/main/main.go
+go build -o ./deploy/exe/plugin-compile.exe ./tools/plugicompile/main/main.go

+ 2 - 6
go.mod

@@ -5,6 +5,7 @@ go 1.23.0
 //go 1.19
 
 require (
+	cicv-data-closedloop v0.0.0-00010101000000-000000000000
 	github.com/aliyun/aliyun-oss-go-sdk v3.0.1+incompatible
 	github.com/bluenviron/goroslib/v2 v2.1.4
 	github.com/gin-gonic/gin v1.9.1
@@ -24,7 +25,6 @@ require (
 	github.com/bytedance/sonic v1.10.2 // indirect
 	github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
 	github.com/chenzhuoyu/iasm v0.9.1 // indirect
-	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
 	github.com/gabriel-vasile/mimetype v1.4.3 // indirect
 	github.com/gin-contrib/sse v0.1.0 // indirect
 	github.com/go-ole/go-ole v1.2.6 // indirect
@@ -32,18 +32,15 @@ require (
 	github.com/go-playground/universal-translator v0.18.1 // indirect
 	github.com/go-playground/validator/v10 v10.17.0 // indirect
 	github.com/goccy/go-json v0.10.2 // indirect
-	github.com/google/go-cmp v0.6.0 // indirect
 	github.com/gookit/color v1.5.4 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/klauspost/cpuid/v2 v2.2.6 // indirect
-	github.com/kr/pretty v0.3.1 // indirect
+	github.com/kr/text v0.2.0 // indirect
 	github.com/leodido/go-urn v1.2.4 // indirect
 	github.com/mattn/go-isatty v0.0.20 // indirect
 	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
 	github.com/modern-go/reflect2 v1.0.2 // indirect
 	github.com/pelletier/go-toml/v2 v2.1.1 // indirect
-	github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
-	github.com/rogpeppe/go-internal v1.10.0 // indirect
 	github.com/tklauser/go-sysconf v0.3.13 // indirect
 	github.com/tklauser/numcpus v0.7.0 // indirect
 	github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
@@ -57,5 +54,4 @@ require (
 	golang.org/x/text v0.16.0 // indirect
 	golang.org/x/time v0.4.0 // indirect
 	google.golang.org/protobuf v1.33.0 // indirect
-	gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
 )

+ 0 - 5
go.sum

@@ -56,11 +56,8 @@ github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
 github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc=
 github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
 github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
-github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
 github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
 github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
 github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
 github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
 github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
@@ -78,11 +75,9 @@ github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9G
 github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
 github.com/pelletier/go-toml/v2 v2.1.1 h1:LWAJwfNvjQZCFIDKWYQaM62NcYeYViCmWIwmOStowAI=
 github.com/pelletier/go-toml/v2 v2.1.1/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
 github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
 github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
 github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
 github.com/shirou/gopsutil v3.21.11+incompatible h1:+1+c1VGhc88SSonWP6foOcLhvnKlUeu/erjjvaPEYiI=

+ 6 - 6
test/oss_test.go

@@ -90,15 +90,15 @@ func TestDeleteDir(t *testing.T) {
 
 func TestOssConnect(t *testing.T) {
 	// 1. 上传文件到oss
-	err := commonConfig.OssBucket.PutObjectFromFile("jili/cloud-config.yaml", "C:\\Users\\15701\\Desktop\\部署\\20250407\\cloud-config.yaml")
-	if err != nil {
-		panic(err)
-	}
-	// 2. 下载oss文件到本地
-	//err := commonConfig.OssBucket.GetObjectToFile("test/cloud-config.yaml", "D:\\cloud-config-3.yaml")
+	//err := commonConfig.OssBucket.PutObjectFromFile("jili/cloud-config.yaml", "C:\\Users\\15701\\Desktop\\部署\\20250407\\cloud-config.yaml")
 	//if err != nil {
 	//	panic(err)
 	//}
+	// 2. 下载oss文件到本地
+	err := commonConfig.OssBucket.GetObjectToFile("trigger/1743584044510/demo2-a138bef8-8b1d-47a7-a949-d4ff929477a1.go", "D:\\demo.go")
+	if err != nil {
+		panic(err)
+	}
 	//err := commonConfig.OssBucket.GetObjectToFile("oss-accesslog/dcl2025-04-01-11-00-00-0001", "D:\\dcl2025")
 	//if err != nil {
 	//	panic(err)

+ 100 - 100
test/zip_test.go

@@ -1,102 +1,102 @@
 package test
 
-import (
-	"archive/zip"
-	"fmt"
-	"io"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"strings"
-	"testing"
-)
-
-func TestZip(t *testing.T) {
-	//src := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20)"
-	//dest := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20).zip"
-	//excludeDir := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20)\\搜索引擎" // 你想排除的子目录
-	//err := ZipDir(src, dest, excludeDir)
-	//if err != nil {
-	//	fmt.Println("Error:", err)
-	//	return
-	//}
-	//fmt.Println("Zip created successfully:", dest)
-	ZipDir2("/root/pjirobot/data/", "/root/pjirobot/data.zip", []string{"config", "map", "mapBuf"})
-}
-
-// 压缩指定目录到ZIP文件,并排除一个指定的子目录
-func ZipDir(src, dest, excludeDir string) error {
-	zipf, err := os.Create(dest)
-	if err != nil {
-		return err
-	}
-	defer zipf.Close()
-
-	archive := zip.NewWriter(zipf)
-	defer archive.Close()
-
-	filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
-		if err != nil {
-			return err
-		}
-
-		header, err := zip.FileInfoHeader(info)
-		if err != nil {
-			return err
-		}
-
-		// 修正文件路径,使其相对于src
-		header.Name, err = filepath.Rel(src, path)
-		if err != nil {
-			return err
-		}
-
-		// 如果路径包含要排除的目录,则跳过
-		if strings.Contains(header.Name, excludeDir) {
-			if info.IsDir() {
-				return filepath.SkipDir // 如果是目录,则跳过整个目录
-			}
-			return nil // 如果是文件,则忽略该文件
-		}
-
-		if info.IsDir() {
-			header.Name += "/"
-		} else {
-			header.Method = zip.Deflate
-		}
-
-		writer, err := archive.CreateHeader(header)
-		if err != nil {
-			return err
-		}
-
-		if !info.IsDir() {
-			file, err := os.Open(path)
-			if err != nil {
-				return err
-			}
-			defer file.Close()
-			_, err = io.Copy(writer, file)
-			return err
-		}
-		return nil
-	})
-
-	return nil
-}
-func ZipDir2(src string, dest string, dirs []string) {
-	// 创建 zip 命令参数
-	args := []string{"-r", dest}
-	for _, dir := range dirs {
-		args = append(args, filepath.Join(src, dir))
-	}
-
-	// 创建 zip 命令
-	cmd := exec.Command("zip", args...)
-
-	// 设置工作目录
-	cmd.Dir = src
-
-	// 执行 zip 命令并获取输出
-	fmt.Println(args)
-}
+//import (
+//	"archive/zip"
+//	"fmt"
+//	"io"
+//	"os"
+//	"os/exec"
+//	"path/filepath"
+//	"strings"
+//	"testing"
+//)
+//
+//func TestZip(t *testing.T) {
+//	//src := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20)"
+//	//dest := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20).zip"
+//	//excludeDir := "C:\\Users\\mlxengingin\\Desktop\\0813\\go从入门到通天(20)\\搜索引擎" // 你想排除的子目录
+//	//err := ZipDir(src, dest, excludeDir)
+//	//if err != nil {
+//	//	fmt.Println("Error:", err)
+//	//	return
+//	//}
+//	//fmt.Println("Zip created successfully:", dest)
+//	ZipDir2("/root/pjirobot/data/", "/root/pjirobot/data.zip", []string{"config", "map", "mapBuf"})
+//}
+//
+//// 压缩指定目录到ZIP文件,并排除一个指定的子目录
+//func ZipDir(src, dest, excludeDir string) error {
+//	zipf, err := os.Create(dest)
+//	if err != nil {
+//		return err
+//	}
+//	defer zipf.Close()
+//
+//	archive := zip.NewWriter(zipf)
+//	defer archive.Close()
+//
+//	filepath.Walk(src, func(path string, info os.FileInfo, err error) error {
+//		if err != nil {
+//			return err
+//		}
+//
+//		header, err := zip.FileInfoHeader(info)
+//		if err != nil {
+//			return err
+//		}
+//
+//		// 修正文件路径,使其相对于src
+//		header.Name, err = filepath.Rel(src, path)
+//		if err != nil {
+//			return err
+//		}
+//
+//		// 如果路径包含要排除的目录,则跳过
+//		if strings.Contains(header.Name, excludeDir) {
+//			if info.IsDir() {
+//				return filepath.SkipDir // 如果是目录,则跳过整个目录
+//			}
+//			return nil // 如果是文件,则忽略该文件
+//		}
+//
+//		if info.IsDir() {
+//			header.Name += "/"
+//		} else {
+//			header.Method = zip.Deflate
+//		}
+//
+//		writer, err := archive.CreateHeader(header)
+//		if err != nil {
+//			return err
+//		}
+//
+//		if !info.IsDir() {
+//			file, err := os.Open(path)
+//			if err != nil {
+//				return err
+//			}
+//			defer file.Close()
+//			_, err = io.Copy(writer, file)
+//			return err
+//		}
+//		return nil
+//	})
+//
+//	return nil
+//}
+//func ZipDir2(src string, dest string, dirs []string) {
+//	// 创建 zip 命令参数
+//	args := []string{"-r", dest}
+//	for _, dir := range dirs {
+//		args = append(args, filepath.Join(src, dir))
+//	}
+//
+//	// 创建 zip 命令
+//	cmd := exec.Command("zip", args...)
+//
+//	// 设置工作目录
+//	cmd.Dir = src
+//
+//	// 执行 zip 命令并获取输出
+//	fmt.Println(args)
+//}