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

cannot specify module path #215

Closed
MeteorsLiu opened this issue Mar 17, 2025 · 5 comments · Fixed by #222
Closed

cannot specify module path #215

MeteorsLiu opened this issue Mar 17, 2025 · 5 comments · Fixed by #222
Assignees
Labels

Comments

@MeteorsLiu
Copy link
Contributor

MeteorsLiu commented Mar 17, 2025

Our team uses llcppg to compare the user-provided llpkg with the generated result to ensure the safety of llpkg.

However, llcppg cannot specify the module path for go.mod, which causes the failure of our verification process.

2025/03/14 06:21:31 check error: llcppg: check fail: 
file not equal: go.mod diff --git a/home/runner/work/llpkg/llpkg/cjson/go.mod b/home/runner/work/llpkg/llpkg/cjson/cjson/go.mod
index 5ad1728..5fb320e [10](https://github.com/MeteorsLiu/llpkg/actions/runs/13849402201/job/38758281904#step:11:11)0644
--- a/home/runner/work/llpkg/llpkg/cjson/go.mod
+++ b/home/runner/work/llpkg/llpkg/cjson/cjson/go.mod
@@ -1,5 +1,5 @@
-module github.com/goplus/llpkg/cjson
+module cjson
 
-go 1.20
+go 1.23.7
 
 require github.com/goplus/llgo v0.10.0 // indirect

In above examples, the module path of user-provided llpkg is github.com/goplus/llpkg/cjson while the llcppg generated one is cjson, which's not equal.

@luoliwoshang
Copy link
Contributor

luoliwoshang commented Mar 17, 2025

okay,i deem it is a nessary feature, may use the modulePath in llcppg.cfg to config the go.mod's modulePath and if dont config this modulePath , and default use the name in llcppg.cfg as the module path.

@xushiwei @aofei @tsingbx what about your views.

@aofei
Copy link
Member

aofei commented Mar 17, 2025

use the modulePath in llcppg.cfg to config the go.mod's modulePath and if dont config this modulePath , and default use the name in llcppg.cfg as the module path.

Works for me.

@tsingbx
Copy link
Contributor

tsingbx commented Mar 17, 2025

modulePath+name作为go mod init 模块名称。

@luoliwoshang
Copy link
Contributor

luoliwoshang commented Mar 17, 2025

modulePath+name作为go mod init 模块名称。

我认为这里的行为更像go mod init 的行为会更合适,允许用户传递任何的modulePath,modulePath+name 会导致用户对于modulePath的作用产生误解,并且当用户希望package name 和 modulePath尾部的name不一致时,这个方案就会无法解决。

I think the behavior here would be more appropriate if it were similar to go mod init, allowing users to pass any modulePath. The modulePath+name approach would cause users to misunderstand the purpose of modulePath, and this solution wouldn't work when users want the package name to be different from the name at the end of the modulePath.

@xushiwei
Copy link
Member

By default, llcppg doesn't generate go.mod. Use -mod <ModPath> to generate go.mod and go.sum.

This was referenced Mar 24, 2025
@luoliwoshang luoliwoshang self-assigned this Mar 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants