This commit is contained in:
shikong 2024-11-24 17:48:35 +08:00
parent e9e9de122a
commit a79eb3c143
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
2 changed files with 24 additions and 1 deletions

View File

@ -38,7 +38,7 @@ func main() {
// 启动 HTTP 服务 // 启动 HTTP 服务
srv := &http.Server{ srv := &http.Server{
Addr: ":8848", Addr: ":10086",
Handler: e, Handler: e,
} }

23
gin/simple_test.go Normal file
View File

@ -0,0 +1,23 @@
package main
import (
"fmt"
"go/build"
"os"
"path/filepath"
"testing"
)
func TestPackage(t *testing.T) {
currentDir, _ := os.Getwd()
workDir, _ := filepath.Abs(currentDir)
fmt.Printf("[+] 工作目录 %s\n", workDir)
pkgDir := filepath.Join(workDir, "pkg/errorx")
pkg, err := build.Default.Import(pkgDir, pkgDir, build.FindOnly|build.ImportComment)
if err != nil {
t.Fatal(err)
}
fmt.Printf("%#v\n", pkg)
fmt.Printf("%#v\n", pkg.Name)
}