diff --git a/bootstrap/cmd/repl.go b/bootstrap/cmd/repl.go index 47429aa..b81690b 100644 --- a/bootstrap/cmd/repl.go +++ b/bootstrap/cmd/repl.go @@ -15,6 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + package cmd import ( @@ -33,6 +34,6 @@ var replCmd = &cobra.Command{ }, } -func init() { +func init() { // nolint:gochecknoinits rootCmd.AddCommand(replCmd) } diff --git a/bootstrap/cmd/root.go b/bootstrap/cmd/root.go index 5c618e5..b4ad35a 100644 --- a/bootstrap/cmd/root.go +++ b/bootstrap/cmd/root.go @@ -15,6 +15,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + +// Package cmd provides the sub commands for the Serene binary. package cmd import ( @@ -62,7 +64,7 @@ func Execute() { } } -func init() { +func init() { // nolint:gochecknoinits cobra.OnInitialize() rootCmd.PersistentFlags().BoolVar( &debugMode, @@ -75,5 +77,4 @@ func init() { "debug-stack", false, "Turns on the call stack debug mode.") - } diff --git a/bootstrap/cmd/run.go b/bootstrap/cmd/run.go index 1e05381..d2430d9 100644 --- a/bootstrap/cmd/run.go +++ b/bootstrap/cmd/run.go @@ -15,6 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + package cmd import ( @@ -32,6 +33,6 @@ var runCmd = &cobra.Command{ }, } -func init() { +func init() { // nolint:gochecknoinits rootCmd.AddCommand(runCmd) } diff --git a/bootstrap/pkg/dl/dl.go b/bootstrap/pkg/dl/dl.go index f0b1f84..24d185c 100644 --- a/bootstrap/pkg/dl/dl.go +++ b/bootstrap/pkg/dl/dl.go @@ -16,6 +16,8 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +// Package dl provides the necessary interface to interact with share +// libraries package dl /* @@ -44,43 +46,39 @@ static void* shareLibLookup(uintptr_t h, const char* name, char** err) { return r; } */ -import "C" -import ( - "fmt" - "unsafe" -) -type SharedLib struct{} +// import "C" +// import ( +// "fmt" +// "unsafe" +// ) -func Open(libPath string) (*SharedLib, error) { - cPath := make([]byte, C.PATH_MAX+1) - cRelName := make([]byte, len(libPath)+1) - copy(cRelName, libPath) +// type SharedLib struct{} - // If the given libPath exists, fill the cPath with the absolute path - // to the file (it follows symlinks). - if C.realpath( - (*C.char)(unsafe.Pointer(&cRelName[0])), - (*C.char)(unsafe.Pointer(&cPath[0]))) == nil { - return nil, fmt.Errorf("can't find the shared library '%s'", libPath) - } +// func Open(libPath string) (*SharedLib, error) { +// cPath := make([]byte, C.PATH_MAX+1) +// cRelName := make([]byte, len(libPath)+1) +// copy(cRelName, libPath) - //filepath := C.GoString((*C.char)(unsafe.Pointer(&cPath[0]))) +// // If the given libPath exists, fill the cPath with the absolute path +// // to the file (it follows symlinks). +// if C.realpath( +// (*C.char)(unsafe.Pointer(&cRelName[0])), +// (*C.char)(unsafe.Pointer(&cPath[0]))) == nil { +// return nil, fmt.Errorf("can't find the shared library '%s'", libPath) +// } - var cErr *C.char - h := C.openShareLib((*C.char)(unsafe.Pointer(&cPath[0])), &cErr) +// var cErr *C.char +// h := C.openShareLib((*C.char)(unsafe.Pointer(&cPath[0])), &cErr) - if h == 0 { - // lock.Unlock() - return nil, fmt.Errorf("failed to open shared library: '%s' due to: '%s'", libPath, C.GoString(cErr)) - } +// if h == 0 { +// // lock.Unlock() +// return nil, fmt.Errorf("failed to open shared library: '%s' due to: '%s'", libPath, C.GoString(cErr)) +// } - // if plugins == nil { - // plugins = make(map[string]*Plugin) - // } - initTask := C.shareLibLookup(h, C.CString("bar"), &cErr) +// initTask := C.shareLibLookup(h, C.CString("bar"), &cErr) - fmt.Printf(">> %p \n", initTask) +// fmt.Printf(">> %p \n", initTask) - return &SharedLib{}, nil -} +// return &SharedLib{}, nil +// } diff --git a/bootstrap/serene.go b/bootstrap/serene.go index e1bbd75..3824be0 100644 --- a/bootstrap/serene.go +++ b/bootstrap/serene.go @@ -15,6 +15,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ + package main import "serene-lang.org/bootstrap/cmd"