Skip to content

Commit 168c99c

Browse files
authored
Merge pull request #345 from xushiwei/q
cl.ConvConfig: add PkgPath
2 parents c99fec4 + 92a3729 commit 168c99c

File tree

4 files changed

+7
-1
lines changed

4 files changed

+7
-1
lines changed

cl/convert.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func ModInit(deps []string, outputDir string, modulePath string) error {
1717
}
1818

1919
type ConvConfig struct {
20+
PkgPath string
2021
PkgName string
2122
ConvSym func(name *ast.Object, mangleName string) (goName string, err error)
2223
OutputDir string
@@ -33,6 +34,7 @@ type ConvConfig struct {
3334

3435
func Convert(config *ConvConfig) (pkg Package, err error) {
3536
cvt, err := convert.NewConverter(&convert.Config{
37+
PkgPath: config.PkgPath,
3638
PkgName: config.PkgName,
3739
ConvSym: config.ConvSym,
3840
OutputDir: config.OutputDir,

cl/internal/convert/convert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ func SetDebug(dbgFlags dbgFlags) {
2323
}
2424

2525
type Config struct {
26+
PkgPath string
2627
PkgName string
2728
ConvSym func(name *ast.Object, mangleName string) (goName string, err error)
2829
OutputDir string
@@ -73,7 +74,7 @@ type Converter struct {
7374
func NewConverter(config *Config) (*Converter, error) {
7475
pkg, err := NewPackage(&PackageConfig{
7576
PkgBase: PkgBase{
76-
PkgPath: ".",
77+
PkgPath: config.PkgPath,
7778
Deps: config.Deps,
7879
Pubs: config.TypeMap,
7980
},

cl/internal/convert/convert_builtin_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ func basicConverter() *Converter {
2626
Libs: "${pkg-config --libs xxx}",
2727
}
2828
converter, err := NewConverter(&Config{
29+
PkgPath: ".",
2930
PkgName: "test",
3031
ConvSym: cltest.NewConvSym(),
3132
OutputDir: tempDir,

cl/internal/convert/convert_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ func testFrom(t *testing.T, dir string, gen bool, validateFunc func(t *testing.T
221221
}
222222

223223
cvt, err := convert.NewConverter(&convert.Config{
224+
PkgPath: ".",
224225
PkgName: cfg.Name,
225226
ConvSym: cltest.GetConvSym(symbPath),
226227
OutputDir: outputDir,
@@ -314,6 +315,7 @@ func TestNewConvert(t *testing.T) {
314315
}
315316

316317
_, err := convert.NewConverter(&convert.Config{
318+
PkgPath: ".",
317319
PkgName: "test",
318320
ConvSym: cltest.NewConvSym(),
319321

0 commit comments

Comments
 (0)