Commit 98249b24 authored by Kirill Smelkov's avatar Kirill Smelkov

myname -> my

This causes the following changes on client side:

	myname.Func	-> my.FuncName
	myname.Pkg	-> my.PkgName

Reason for the change is that we are going to introduce my.File and
my.Line which would not fit into myname package naming.
parent a092b308
......@@ -22,7 +22,7 @@ import (
"fmt"
"strings"
"lab.nexedi.com/kirr/go123/myname"
"lab.nexedi.com/kirr/go123/my"
"lab.nexedi.com/kirr/go123/xruntime"
)
......@@ -147,7 +147,7 @@ var (
)
func init() {
_errorpkgname = myname.Pkg()
_errorpkgname = my.PkgName()
_errorpkgdot = _errorpkgname + "."
_errorraise = _errorpkgname + ".Raise"
}
......@@ -187,7 +187,7 @@ func Addcallingcontext(topfunc string, e *Error) *Error {
// the error, if non-nil, will be returned with added calling context - see
// Addcallingcontext for details.
func Runx(xf func()) (err error) {
here := myname.Func()
here := my.FuncName()
defer Catch(func(e *Error) {
err = Addcallingcontext(here, e)
})
......
......@@ -23,7 +23,7 @@ import (
"runtime"
"testing"
"lab.nexedi.com/kirr/go123/myname"
"lab.nexedi.com/kirr/go123/my"
)
func do_raise1() {
......@@ -138,7 +138,7 @@ func TestErrAddCallingContext(t *testing.T) {
for _, tt := range tests {
func() {
myfunc := myname.Func()
myfunc := my.FuncName()
defer Catch(func(e *Error) {
e = Addcallingcontext(myfunc, e)
msg := e.Error()
......
......@@ -15,8 +15,8 @@
//
// See COPYING file for full licensing terms.
// Package myname provides easy way to determine current function's name and package
package myname
// Package my provides easy way to determine current function's name and other context
package my
import (
"fmt"
......@@ -34,15 +34,15 @@ func _myfuncname(nskip int) string {
return f.Name()
}
// get name of currently running function (caller of Func())
// FuncName returns name of currently running function (caller of FuncName())
// name is fully qualified package/name.function(.x)
func Func() string {
func FuncName() string {
return _myfuncname(3)
}
// get name of currently running function's package
// PkgName returns name of currently running function's package
// package is fully qualified package/name
func Pkg() string {
func PkgName() string {
myfunc := _myfuncname(3)
if myfunc == "" {
return ""
......
......@@ -15,7 +15,7 @@
//
// See COPYING file for full licensing terms.
package myname
package my
import (
"strings"
......@@ -23,11 +23,11 @@ import (
)
func TestMyFuncName(t *testing.T) {
myfunc := Func()
// go test changes full package name (putting filesystem of the tree into ti)
myfunc := FuncName()
// go test changes full package name (putting filesystem of the tree into it)
// thus we check only for suffix
wantsuffix := ".TestMyFuncName"
if !strings.HasSuffix(myfunc, wantsuffix) {
t.Errorf("myname.Func() -> %v ; want *%v", myfunc, wantsuffix)
t.Errorf("my.FuncName() -> %v ; want *%v", myfunc, wantsuffix)
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment