Spaces:
Sleeping
Sleeping
朱东升
commited on
Commit
·
4770e23
1
Parent(s):
3f1394b
requirements update17
Browse files
app.py
CHANGED
@@ -98,7 +98,9 @@ def evaluate_code(code, language):
|
|
98 |
|
99 |
import tempfile
|
100 |
|
101 |
-
|
|
|
|
|
102 |
temp_file_path = temp_file.name
|
103 |
temp_file.write(code.encode('utf-8'))
|
104 |
|
|
|
98 |
|
99 |
import tempfile
|
100 |
|
101 |
+
# 对于Go语言,确保文件以_test.go结尾
|
102 |
+
suffix = "_test.go" if language.lower() == "go" else f".{language}"
|
103 |
+
with tempfile.NamedTemporaryFile(suffix=suffix, delete=False) as temp_file:
|
104 |
temp_file_path = temp_file.name
|
105 |
temp_file.write(code.encode('utf-8'))
|
106 |
|