Closed LinYunling closed 6 days ago
Hello @LinYunling
Sorry, what does it doesn't work
means? Could you please provider more information?
before modify:
kcl.mod
[package]
name = "mod1"
edition = "v0.9.0"
version = "0.0.1"
main.k
import mod1
a = mod1.test1 {
name = "hello"
}
I find the module name is wrong, so I need to modify it And I modify the kcl.mod file and main.k (just modify the module name)
kcl.mod
[package]
name = "mod1change"
edition = "v0.9.0"
version = "0.0.1"
main.k
import mod1change
a = mod1change.test1 {
name = "hello"
}
run main.k report the error:
kcl main.k
Error: error[E2F04]: CannotFindModule
--> D:\code\kcltest\main.k:1:1
|
1 | import mod1change
| ^ pkgpath mod1change not found in the program
|
suggestion: try 'kcl mod add mod1change' to download the package not found
suggestion: find more package on 'https://artifacthub.io'
error[E2F04]: CannotFindModule
--> D:\code\kcltest\main.k:1:1
|
1 | import mod1change
| ^ Cannot find the module mod1change from mod1change
|
suggestion: try 'kcl mod add mod1change' to download the package not found
suggestion: find more package on 'https://artifacthub.io'
error[E2G22]: TypeError
--> D:\code\kcltest\main.k:3:5
|
3 | a = mod1change.test1 {
| ^ attribute 'test1' not found in 'module 'mod1change''
|
I see. You need to change the folder name same time Because you don't add a relative dependency between main.k and mod1change
.
|- mod1change
| |- kcl.mod
|- main.k
got it, I forgot, thank you very much
use "kcl mod init modame" command init a module and I need to change the module name from "modame" to "modname" I modify the kcl.mod file:
to
But it doesn't work