mirror of
https://github.com/criyle/go-judge.git
synced 2025-09-26 22:39:12 +08:00
fix: typo (#157)
* fix: typo * fix: typo * fix: typo * refactor: if -> switch * style: make gopls happy
This commit is contained in:
parent
6211423165
commit
2b42c8bed5
@ -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"
|
||||
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
|
2
env/env_linux.go
vendored
2
env/env_linux.go
vendored
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user