Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/go-judge-ffi/cinterface.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ var (
srcPrefix []string
)

func newFilsStore(dir string) (filestore.FileStore, error) {
func newFileStore(dir string) (filestore.FileStore, error) {
if dir == "" {
if runtime.GOOS == "linux" {
dir = "/dev/shm"
Expand Down Expand Up @@ -83,7 +83,7 @@ func Init(i *C.char) C.int {
srcPrefix = strings.Split(ip.SrcPrefix, ",")

var err error
fs, err = newFilsStore(ip.Dir)
fs, err = newFileStore(ip.Dir)
if err != nil {
log.Fatalln("file store create failed", err)
}
Expand Down
7 changes: 4 additions & 3 deletions cmd/go-judge/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,15 @@ func newListener(addr string) (net.Listener, error) {
}

var ips []net.IP
if host == "" {
switch host {
case "":
return net.Listen("tcp", addr)
} else if host == "localhost" {
case "localhost":
ips, err = getLocalhostIP()
if err != nil {
return nil, err
}
} else {
default:
ips, err = net.LookupIP(host)
if err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions cmd/go-judge/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func main() {
warnIfNotLinux()

// Init environment pool
fs, fsCleanUp := newFilsStore(conf)
fs, fsCleanUp := newFileStore(conf)
b, builderParam := newEnvBuilder(conf)
envPool := newEnvPool(b, conf.EnableMetrics)
prefork(envPool, conf.PreFork)
Expand Down Expand Up @@ -455,7 +455,7 @@ func grpcTokenAuth(token string) func(context.Context) (context.Context, error)
}
}

func newFilsStore(conf *config.Config) (filestore.FileStore, func() error) {
func newFileStore(conf *config.Config) (filestore.FileStore, func() error) {
const timeoutCheckInterval = 15 * time.Second
var cleanUp func() error

Expand Down Expand Up @@ -555,7 +555,7 @@ func newForceGCWorker(conf *config.Config) {
}()
}

func generateHandleVersion(conf *config.Config, builderParam map[string]any) func(*gin.Context) {
func generateHandleVersion(_ *config.Config, _ map[string]any) func(*gin.Context) {
return func(c *gin.Context) {
c.JSON(http.StatusOK, gin.H{
"buildVersion": version.Version,
Expand Down
2 changes: 1 addition & 1 deletion env/env_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func kernelVersion() (major int, minor int) {
value = (value * 10) + int(c-'0')
} else {
// Note that we're assuming N.N.N here. If we see anything else we are likely to
// mis-parse it.
// misparse it.
values[vi] = value
vi++
if vi >= len(values) {
Expand Down