From 5fa8db0b7c93c14e6b019ba2157939ac9ed5dbf9 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sat, 7 Jul 2018 18:10:42 +0200 Subject: [PATCH] Init(manifest, typechecker), now typechecker is optional (not nil, optional) + rename package 'gfw' into 'aicra' --- server.go | 10 +++++----- types.go | 2 +- util.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server.go b/server.go index ac2c417..e1fa430 100644 --- a/server.go +++ b/server.go @@ -1,4 +1,4 @@ -package gfw +package aicra import ( "fmt" @@ -15,7 +15,7 @@ import ( // - path is the configuration path // - if typeChecker is nil, defaults will be used (all *.so files // 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 */ inst := &Server{ @@ -30,9 +30,9 @@ func Init(path string, typeChecker *checker.TypeRegistry) (*Server, error) { } inst.config = config - /* (3) Store registry if not nil */ - if typeChecker != nil { - inst.Checker = typeChecker + /* (3) Store registry if given */ + if len(typeChecker) > 0 && typeChecker[0] != nil { + inst.Checker = typeChecker[0] return inst, nil } diff --git a/types.go b/types.go index ee0bebb..364cbd2 100644 --- a/types.go +++ b/types.go @@ -1,4 +1,4 @@ -package gfw +package aicra import ( "git.xdrm.io/go/aicra/checker" diff --git a/util.go b/util.go index b8c9f5c..39b7809 100644 --- a/util.go +++ b/util.go @@ -1,4 +1,4 @@ -package gfw +package aicra import ( "encoding/json"