From 7254c48f9aad833d02ffb5ebc5d3074e3bc0d770 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 11 Feb 2025 10:01:53 -0500 Subject: [PATCH] chore(executor): move struct to meta.go --- internal/executor/dummy/executor.go | 2 -- internal/executor/dummy/meta.go | 2 ++ internal/executor/local/executor.go | 2 -- internal/executor/local/meta.go | 2 ++ internal/executor/sandbox/executor.go | 6 ------ internal/executor/sandbox/meta.go | 7 +++++++ 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/internal/executor/dummy/executor.go b/internal/executor/dummy/executor.go index 4eb6a14..9891182 100644 --- a/internal/executor/dummy/executor.go +++ b/internal/executor/dummy/executor.go @@ -5,8 +5,6 @@ import ( "github.com/joint-online-judge/JOJ3/internal/stage" ) -type Dummy struct{} - func (e *Dummy) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) { var res []stage.ExecutorResult for range cmds { diff --git a/internal/executor/dummy/meta.go b/internal/executor/dummy/meta.go index b745e19..58b0163 100644 --- a/internal/executor/dummy/meta.go +++ b/internal/executor/dummy/meta.go @@ -4,6 +4,8 @@ import "github.com/joint-online-judge/JOJ3/internal/stage" var name = "dummy" +type Dummy struct{} + func init() { stage.RegisterExecutor(name, &Dummy{}) } diff --git a/internal/executor/local/executor.go b/internal/executor/local/executor.go index a9dd556..919ea54 100644 --- a/internal/executor/local/executor.go +++ b/internal/executor/local/executor.go @@ -15,8 +15,6 @@ import ( "github.com/joint-online-judge/JOJ3/internal/stage" ) -type Local struct{} - func generateResult( err error, processState *os.ProcessState, diff --git a/internal/executor/local/meta.go b/internal/executor/local/meta.go index b6bd99a..703017a 100644 --- a/internal/executor/local/meta.go +++ b/internal/executor/local/meta.go @@ -4,6 +4,8 @@ import "github.com/joint-online-judge/JOJ3/internal/stage" var name = "local" +type Local struct{} + func init() { stage.RegisterExecutor(name, &Local{}) } diff --git a/internal/executor/sandbox/executor.go b/internal/executor/sandbox/executor.go index c7d3e5c..4cd9743 100644 --- a/internal/executor/sandbox/executor.go +++ b/internal/executor/sandbox/executor.go @@ -10,12 +10,6 @@ import ( "google.golang.org/protobuf/proto" ) -type Sandbox struct { - execServer, token string - cachedMap map[string]string - execClient pb.ExecutorClient -} - func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) { var err error if e.execClient == nil { diff --git a/internal/executor/sandbox/meta.go b/internal/executor/sandbox/meta.go index d3a2ba8..2ab62fc 100644 --- a/internal/executor/sandbox/meta.go +++ b/internal/executor/sandbox/meta.go @@ -1,11 +1,18 @@ package sandbox import ( + "github.com/criyle/go-judge/pb" "github.com/joint-online-judge/JOJ3/internal/stage" ) var name = "sandbox" +type Sandbox struct { + execServer, token string + cachedMap map[string]string + execClient pb.ExecutorClient +} + func init() { stage.RegisterExecutor(name, &Sandbox{ execServer: "localhost:5051",