Init(manifest, typechecker), now typechecker is optional (not nil, optional) + rename package 'gfw' into 'aicra'

This commit is contained in:
Adrien Marquès 2018-07-07 18:10:42 +02:00
parent ee72e2d285
commit 5fa8db0b7c
3 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
package gfw package aicra
import ( import (
"fmt" "fmt"
@ -15,7 +15,7 @@ import (
// - path is the configuration path // - path is the configuration path
// - if typeChecker is nil, defaults will be used (all *.so files // - if typeChecker is nil, defaults will be used (all *.so files
// inside ./.build/types local directory) // inside ./.build/types local directory)
func Init(path string, typeChecker *checker.TypeRegistry) (*Server, error) { func Init(path string, typeChecker ...*checker.TypeRegistry) (*Server, error) {
/* (1) Init instance */ /* (1) Init instance */
inst := &Server{ inst := &Server{
@ -30,9 +30,9 @@ func Init(path string, typeChecker *checker.TypeRegistry) (*Server, error) {
} }
inst.config = config inst.config = config
/* (3) Store registry if not nil */ /* (3) Store registry if given */
if typeChecker != nil { if len(typeChecker) > 0 && typeChecker[0] != nil {
inst.Checker = typeChecker inst.Checker = typeChecker[0]
return inst, nil return inst, nil
} }

View File

@ -1,4 +1,4 @@
package gfw package aicra
import ( import (
"git.xdrm.io/go/aicra/checker" "git.xdrm.io/go/aicra/checker"

View File

@ -1,4 +1,4 @@
package gfw package aicra
import ( import (
"encoding/json" "encoding/json"