Skip to content

Commit 910df89

Browse files
authoredOct 16, 2024··
Merge pull request #104 from Peefy/fix-krm-kcl-print-output
fix: krm kcl print output
2 parents 6915920 + 376143c commit 910df89

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed
 

‎go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ require (
1010
k8s.io/apimachinery v0.31.1
1111
k8s.io/cli-runtime v0.31.1
1212
k8s.io/client-go v0.31.1
13-
kcl-lang.io/cli v0.10.3
13+
kcl-lang.io/cli v0.10.4-0.20241016021654-a8eb2b56bdd8
1414
kcl-lang.io/kpm v0.10.0
1515
sigs.k8s.io/controller-runtime v0.19.0
1616
sigs.k8s.io/kustomize/kyaml v0.17.2

‎go.sum

+2-2
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,8 @@ k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 h1:BZqlfIlq5YbRMFko6/PM7F
14391439
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340/go.mod h1:yD4MZYeKMBwQKVht279WycxKyM84kkAx2DPrTXaeb98=
14401440
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 h1:pUdcCO1Lk/tbT5ztQWOBi5HBgbBP1J8+AsQnQCKsi8A=
14411441
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
1442-
kcl-lang.io/cli v0.10.3 h1:LwVr60IG6wFnhFDL4nGdq3u7Be0/rio9yT4uNTPaSTA=
1443-
kcl-lang.io/cli v0.10.3/go.mod h1:rhJTKGuav/B8SJO8VLM07TRWzBVdEo/tAfnCKjL71fo=
1442+
kcl-lang.io/cli v0.10.4-0.20241016021654-a8eb2b56bdd8 h1:GGbmIDVpN30/zEocYwMGVYbN7h80GPSz0ootfXV+xjk=
1443+
kcl-lang.io/cli v0.10.4-0.20241016021654-a8eb2b56bdd8/go.mod h1:rhJTKGuav/B8SJO8VLM07TRWzBVdEo/tAfnCKjL71fo=
14441444
kcl-lang.io/kcl-go v0.10.3 h1:S2t+RdIl1d9bhIqcw7rd0Zk/Th2u7kSaAgASbbOuw+w=
14451445
kcl-lang.io/kcl-go v0.10.3/go.mod h1:kcXB9Ws4MTMj6zp5YXGxkx+Z4HieIrtlYDnFDhfs2mg=
14461446
kcl-lang.io/kcl-openapi v0.9.0 h1:HUnc5pUGde83PI5CAe1ZvZhdbcxD9X2ABUp1tV+oYqw=

‎pkg/config/config_test.go

+16
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,22 @@ spec:
163163
`,
164164
expectResult: `a: Hello World!`,
165165
},
166+
{
167+
name: "KCLRunWithDebugPrint",
168+
config: `apiVersion: krm.kcl.dev/v1alpha1
169+
kind: KCLRun
170+
metadata:
171+
name: my-kcl-fn
172+
namespace: foo
173+
spec:
174+
source: |
175+
print("hello world")
176+
{
177+
data = 1
178+
}
179+
`,
180+
expectResult: `data: 1`,
181+
},
166182
}
167183
for _, tc := range testcases {
168184
tc := tc

‎pkg/edit/bootstrap.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type KCLEntryOrigin struct {
3838
func KCLEntryOriginTmpDirCleanup(entry *KCLEntryOrigin) {
3939
if entry.tmpDir != "" {
4040
if _, err := os.Stat(entry.tmpDir); err == nil {
41-
err = os.RemoveAll(entry.tmpDir)
41+
_ = os.RemoveAll(entry.tmpDir)
4242
}
4343
}
4444
}
@@ -130,7 +130,7 @@ func SourceToTempEntry(src string, opts ...getter.ClientOption) (*KCLEntryOrigin
130130
// May be a inline code source.
131131
tmpDir, err := os.MkdirTemp("", "kcl-sandbox")
132132
if err != nil {
133-
return &KCLEntryOrigin{"", ""}, fmt.Errorf("error creating temp directory: %v", err)
133+
return &KCLEntryOrigin{"", ""}, fmt.Errorf("error creating temp directory: %v", err)
134134
}
135135
// Write kcl code in the temp file.
136136
file := filepath.Join(tmpDir, "prog.k")

0 commit comments

Comments
 (0)
Please sign in to comment.