mirror of
https://gitee.com/shikong-sk/golang-study
synced 2025-02-22 23:12:15 +08:00
测试
This commit is contained in:
parent
e9e9de122a
commit
a79eb3c143
@ -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
23
gin/simple_test.go
Normal 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)
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user