Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible with GOP file breakpoints #13

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added _fixtures/goptest/.DS_Store
Binary file not shown.
9 changes: 9 additions & 0 deletions _fixtures/goptest/a.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package main

func a() {
println("a")
}

func Ab() {
println("ab")
}
68 changes: 68 additions & 0 deletions _fixtures/goptest/b.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package main

import (
"fmt"
c "gop-sample/cpkag"
ab "gop-sample/cpkag/b"
ss "gop-sample/cpkag/b/ss"
k "gop-sample/cpkag/k"
myutils "gop-sample/cpkag/utils"
g "gop-sample/gpkag"
rootutils "gop-sample/utils"
"os"
"path/filepath"

remote "github.com/liuscraft/testgomod/utils"
)

bb := 3
Ab()
ab.Ab()
ab.Ac()
ss.Ab()
ss.Bs()
fmt.Println(bb)
k.K()
k.Kk()
k.Ab()
remote.TestCsgo()
myutils.TestCsgo()
rootutils.TestCsgo()

a()
c.P()
c.Gg()
g.G()
fmt.Println("b")
fmt.Println("b")
fmt.Println("b")
fmt.Println("b")
fmt.Println("b")
fmt.Println("b")
fmt.Println("b")

// 指定绝对路径
absolutePath := "/Users/liushunshun/codings/goplus_project/gop-sample"

// 相对路径
relativePath := "../"

// 构建完整路径
fullPath := filepath.Join(absolutePath, relativePath)

// 查找文件
fileInfo, err := os.Stat(fullPath)
if err != nil {
if os.IsNotExist(err) {
fmt.Println("文件不存在")
} else {
fmt.Println("发生错误:", err)
}
return
}

if fileInfo.IsDir() {
fmt.Println("找到目录:", fullPath)
} else {
fmt.Println("找到文件:", fullPath)
}
8 changes: 8 additions & 0 deletions _fixtures/goptest/b_test.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import (
c "gop-sample/cpkag"
"testing"
)

func TestC(t *testing.T) {
c.P()
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/b/ab.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ab

func Ab() {
println("ab")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/b/ac.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ab

func Ac() {
println("ac")
}
8 changes: 8 additions & 0 deletions _fixtures/goptest/cpkag/b/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ab

import "fmt"
//line cpkag/b/ab.gop:3:1
func Ab() {
//line cpkag/b/ab.gop:4:1
fmt.Println("ab")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/b/ss/b.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ss

func Bs() {
println("bs")
}
13 changes: 13 additions & 0 deletions _fixtures/goptest/cpkag/b/ss/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package ss

import "fmt"
//line cpkag/b/ss/b.gop:3:1
func Bs() {
//line cpkag/b/ss/b.gop:4:1
fmt.Println("bs")
}
//line cpkag/b/ss/ss.gop:3:1
func Ab() {
//line cpkag/b/ss/ss.gop:4:1
fmt.Println("ab")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/b/ss/ss.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ss

func Ab() {
println("ab")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/c.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cpkag

func P() {
println("c")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/gg.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package cpkag

func Gg(){
println("gg")
}
8 changes: 8 additions & 0 deletions _fixtures/goptest/cpkag/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package cpkag

import "fmt"
//line cpkag/gg.gop:3:1
func Gg() {
//line cpkag/gg.gop:4:1
fmt.Println("gg")
}
5 changes: 5 additions & 0 deletions _fixtures/goptest/cpkag/k/c.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package k

func K() {
println("k")
}
13 changes: 13 additions & 0 deletions _fixtures/goptest/cpkag/k/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package k

import "fmt"
//line cpkag/k/k.gop:3:1
func Kk() {
//line cpkag/k/k.gop:4:1
fmt.Println("kk")
}
//line cpkag/k/k.gop:7:1
func Ab() {
//line cpkag/k/k.gop:8:1
fmt.Println("ab")
}
9 changes: 9 additions & 0 deletions _fixtures/goptest/cpkag/k/k.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package k

func Kk() {
println("kk")
}

func Ab() {
println("ab")
}
7 changes: 7 additions & 0 deletions _fixtures/goptest/cpkag/utils/csgo.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package utils

import "fmt"

func TestCsgo() {
fmt.Println("my testcsgo")
}
8 changes: 8 additions & 0 deletions _fixtures/goptest/cpkag/utils/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package utils

import "fmt"
//line cpkag/utils/csgo.gop:5:1
func TestCsgo() {
//line cpkag/utils/csgo.gop:6:1
fmt.Println("my testcsgo")
}
9 changes: 9 additions & 0 deletions _fixtures/goptest/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module gop-sample

go 1.21.5

toolchain go1.21.6

replace github.com/goplus/gop => /Users/xlj/Documents/Github/gop

require github.com/liuscraft/testgomod v0.0.0-20240114062333-3352239bb6d1 // indirect
2 changes: 2 additions & 0 deletions _fixtures/goptest/go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github.com/liuscraft/testgomod v0.0.0-20240114062333-3352239bb6d1 h1:NOSBQHu6hJ8l1etBPg5v9XCRxtsixqHDL7EPlajRqJg=
github.com/liuscraft/testgomod v0.0.0-20240114062333-3352239bb6d1/go.mod h1:Rd9S8gaMZNqQCwWXI/Tg169w9FvHWrbypL828g160i0=
5 changes: 5 additions & 0 deletions _fixtures/goptest/gop.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module gop-sample

go 1.21

gop 1.1
105 changes: 105 additions & 0 deletions _fixtures/goptest/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
package main

import (
"fmt"
"os"
"gop-sample/cpkag"
ab "gop-sample/cpkag/b"
"gop-sample/cpkag/b/ss"
"gop-sample/cpkag/k"
"gop-sample/cpkag/utils"
"gop-sample/gpkag"
utils1 "gop-sample/utils"
"path/filepath"
utils2 "github.com/liuscraft/testgomod/utils"
)
//line a.gop:3:1
func a() {
//line a.gop:4:1
fmt.Println("a")
}
//line a.gop:7:1
func Ab() {
//line a.gop:8:1
fmt.Println("ab")
}
//line b.gop:18
func main() {
//line b.gop:18:1
bb := 3
//line b.gop:19:1
Ab()
//line b.gop:20:1
ab.Ab()
//line b.gop:21:1
ab.Ac()
//line b.gop:22:1
ss.Ab()
//line b.gop:23:1
ss.Bs()
//line b.gop:24:1
fmt.Println(bb)
//line b.gop:25:1
k.K()
//line b.gop:26:1
k.Kk()
//line b.gop:27:1
k.Ab()
//line b.gop:28:1
utils2.TestCsgo()
//line b.gop:29:1
utils.TestCsgo()
//line b.gop:30:1
utils1.TestCsgo()
//line b.gop:32:1
a()
//line b.gop:33:1
cpkag.P()
//line b.gop:34:1
cpkag.Gg()
//line b.gop:35:1
gpkag.G()
//line b.gop:36:1
fmt.Println("b")
//line b.gop:37:1
fmt.Println("b")
//line b.gop:38:1
fmt.Println("b")
//line b.gop:39:1
fmt.Println("b")
//line b.gop:40:1
fmt.Println("b")
//line b.gop:41:1
fmt.Println("b")
//line b.gop:42:1
fmt.Println("b")
//line b.gop:45:1
absolutePath := "/Users/liushunshun/codings/goplus_project/gop-sample"
//line b.gop:48:1
relativePath := "../"
//line b.gop:51:1
fullPath := filepath.Join(absolutePath, relativePath)
//line b.gop:54:1
fileInfo, err := os.Stat(fullPath)
//line b.gop:55:1
if err != nil {
//line b.gop:56:1
if os.IsNotExist(err) {
//line b.gop:57:1
fmt.Println("文件不存在")
} else {
//line b.gop:59:1
fmt.Println("发生错误:", err)
}
//line b.gop:61:1
return
}
//line b.gop:64:1
if fileInfo.IsDir() {
//line b.gop:65:1
fmt.Println("找到目录:", fullPath)
} else {
//line b.gop:67:1
fmt.Println("找到文件:", fullPath)
}
}
11 changes: 11 additions & 0 deletions _fixtures/goptest/gop_autogen2_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main_test

import (
"testing"

"github.com/liuscraft/testgomod/utils"
)

func TestCsgo1(t *testing.T) {
utils.TestCsgo()
}
11 changes: 11 additions & 0 deletions _fixtures/goptest/gop_autogen_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"gop-sample/cpkag"
"testing"
)
//line b_test.gop:6:1
func TestC(t *testing.T) {
//line b_test.gop:7:1
cpkag.P()
}
7 changes: 7 additions & 0 deletions _fixtures/goptest/gpkag/g.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package gpkag

import "fmt"

func G() {
fmt.Println("g")
}
7 changes: 7 additions & 0 deletions _fixtures/goptest/utils/csgo.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package utils

import "fmt"

func TestCsgo() {
fmt.Println("root testcsgo")
}
16 changes: 16 additions & 0 deletions _fixtures/goptest/utils/csgo_test.gop
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package utils

import "testing"

func TestCsgo2(t *testing.T) {
tests := []struct {
name string
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
TestCsgo()
})
}
}
8 changes: 8 additions & 0 deletions _fixtures/goptest/utils/gop_autogen.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package utils

import "fmt"
//line utils/csgo.gop:5:1
func TestCsgo() {
//line utils/csgo.gop:6:1
fmt.Println("root testcsgo")
}
Loading