Fix the linting issues on the core package

This commit is contained in:
Sameer Rahmani 2021-01-25 17:50:33 +00:00
parent 30669d9327
commit 23d397b94e
4 changed files with 9 additions and 7 deletions

View File

@ -169,14 +169,16 @@ func (k *Keyword) Eval(rt *Runtime, scope IScope) (*Keyword, IError) {
} }
// Extracts the different parts of the keyword // Extracts the different parts of the keyword
func extractParts(s string) (string, string) { func extractParts(s string) (nspart, namepart string) {
parts := strings.Split(s, "/") parts := strings.Split(s, "/")
namepart = parts[0]
if len(parts) == 2 { if len(parts) == 2 {
return parts[0], parts[1] nspart = parts[0]
namepart = parts[1]
} }
return "", parts[0] return
} }
func MakeKeyword(n Node, name string) (*Keyword, IError) { func MakeKeyword(n Node, name string) (*Keyword, IError) {

View File

@ -252,7 +252,7 @@ func RequireNamespace(rt *Runtime, namespace IExpr) (IExpr, IError) {
} }
// MakeNS creates a new namespace with the given `name` and `source` // MakeNS creates a new namespace with the given `name` and `source`
func MakeNS(rt *Runtime, name string, source string) Namespace { func MakeNS(rt *Runtime, name, source string) Namespace {
s := MakeScope(rt, nil, &name) s := MakeScope(rt, nil, &name)
return Namespace{ return Namespace{

View File

@ -18,6 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
package core package core
func ReadString(ns string, input string) (*Block, IError) { func ReadString(ns, input string) (*Block, IError) {
return ParseToAST(ns, input) return ParseToAST(ns, input)
} }

View File

@ -114,7 +114,7 @@ func (r *Runtime) GetNS(ns string) (*Namespace, bool) {
// CreateNS is a helper function to create a namespace and set it to be // CreateNS is a helper function to create a namespace and set it to be
// the current namespace of the runtime. `MakeNS` is much preferred // the current namespace of the runtime. `MakeNS` is much preferred
func (r *Runtime) CreateNS(name string, source string, setAsCurrent bool) { func (r *Runtime) CreateNS(name, source string, setAsCurrent bool) {
ns := MakeNS(r, name, source) ns := MakeNS(r, name, source)
if setAsCurrent { if setAsCurrent {
@ -139,7 +139,7 @@ func nsNameToPath(ns string) string {
".", "/", ".", "/",
// TODO: checkout the different OSs for character supports in // TODO: checkout the different OSs for character supports in
// the filesystem level // the filesystem level
//"-", "_", // "-", "_",
) )
return replacer.Replace(ns) + ".srn" return replacer.Replace(ns) + ".srn"
} }