Skip to content

Commit 16a370b

Browse files
Cleaning in the example
1 parent 1133b1e commit 16a370b

2 files changed

Lines changed: 6 additions & 0 deletions

File tree

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ package main
3535
import (
3636
"fmt"
3737
"log"
38+
"os"
39+
"path/filepath"
3840

3941
coderunner "github.com/thewizardplusplus/go-code-runner"
4042
)
@@ -55,6 +57,7 @@ func main() {
5557
if err != nil {
5658
log.Fatal(err)
5759
}
60+
defer os.RemoveAll(filepath.Dir(pathToCode)) // nolint: errcheck
5861

5962
pathToExecutable, err := coderunner.CompileCode(pathToCode)
6063
if err != nil {

examples_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package coderunner_test
33
import (
44
"fmt"
55
"log"
6+
"os"
7+
"path/filepath"
68

79
coderunner "github.com/thewizardplusplus/go-code-runner"
810
)
@@ -23,6 +25,7 @@ func Example() {
2325
if err != nil {
2426
log.Fatal(err)
2527
}
28+
defer os.RemoveAll(filepath.Dir(pathToCode)) // nolint: errcheck
2629

2730
pathToExecutable, err := coderunner.CompileCode(pathToCode)
2831
if err != nil {

0 commit comments

Comments
 (0)