Skip to content

Commit fe4b0e0

Browse files
committed
Removed debugging messages;
Replace path.IsAbs() by filepath.IsAbs().
1 parent 56ba492 commit fe4b0e0

5 files changed

Lines changed: 8 additions & 16 deletions

File tree

internal/cmd/copy_go_code/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import (
44
"bytes"
55
"flag"
66
"fmt"
7-
"github.com/gomlx/go-xla/internal/must"
87
"io"
98
"os"
109
"path"
10+
"path/filepath"
1111
"regexp"
1212
"strings"
13+
14+
"github.com/gomlx/go-xla/internal/must"
1315
)
1416

1517
var (
@@ -47,7 +49,7 @@ func main() {
4749

4850
// Find the original file
4951
originalPath := *flagOriginalGoFile
50-
if !path.IsAbs(originalPath) {
52+
if !filepath.IsAbs(originalPath) {
5153
currentPath := must.M1(os.Getwd())
5254
for {
5355
originalPath = path.Join(currentPath, *flagOriginalGoFile)

pkg/pjrt/dynamiclib_base.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ package pjrt
2323
*/
2424
import "C"
2525
import (
26-
"fmt"
2726
"os"
28-
"path"
2927
"path/filepath"
3028
"regexp"
3129
"slices"
@@ -94,7 +92,7 @@ func loadNamedPlugin(name string) (*Plugin, error) {
9492
if plugin, found := loadedPlugins[name]; found {
9593
return plugin, nil
9694
}
97-
if path.IsAbs(name) {
95+
if filepath.IsAbs(name) {
9896
for _, plugin := range loadedPlugins {
9997
if plugin.Path() == name {
10098
return plugin, nil
@@ -104,7 +102,7 @@ func loadNamedPlugin(name string) (*Plugin, error) {
104102

105103
// Search path to plugin -- except if name is an absolute path.
106104
pluginPath := name
107-
if !path.IsAbs(pluginPath) {
105+
if !filepath.IsAbs(pluginPath) {
108106
var found bool
109107
pluginPath, found = searchPlugin(name)
110108
if !found {
@@ -190,7 +188,6 @@ func searchPlugins(searchName string) (pluginsPaths map[string]string) {
190188
}
191189

192190
// Search for plugins in other paths.
193-
fmt.Printf("- Searching for plugin %q:\n", searchName)
194191
for _, pluginPath := range pluginSearchPaths {
195192
for _, pattern := range []string{
196193
"pjrt-plugin-*.so", "pjrt_plugin_*.so", "pjrt_c_api_*_plugin.so",
@@ -202,22 +199,18 @@ func searchPlugins(searchName string) (pluginsPaths map[string]string) {
202199
}
203200
for _, candidate := range candidates {
204201
name := pathToPluginName(candidate)
205-
fmt.Printf("\t - Evaluating plugin candidate %q: named %q\n", candidate, name)
206202
if name == "" {
207203
continue
208204
}
209205
if searchName != "" && searchName != name {
210-
fmt.Println("\t (skipped, name doesn't match)")
211206
continue
212207
}
213208
if _, found := pluginsPaths[name]; found {
214209
// We already have a plugin with that name.
215-
fmt.Println("\t (skipped, plugin already loaded with that name)")
216210
continue
217211
}
218212
err := checkPlugin(name, candidate)
219213
if err != nil {
220-
fmt.Println("\t (skipped, plugin file didn't check)")
221214
continue
222215
}
223216
pluginsPaths[name] = candidate

pkg/pjrt/dynamiclib_darwin.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import "C"
2727

2828
import (
2929
"os"
30-
"path"
3130
"path/filepath"
3231
"strings"
3332
"syscall"
@@ -59,7 +58,7 @@ func osDefaultLibraryPaths() []string {
5958
// Standard environment variables.
6059
for _, varName := range []string{"DYLD_LIBRARY_PATH", "LD_LIBRARY_PATH"} {
6160
for ldPath := range strings.SplitSeq(os.Getenv(varName), string(os.PathListSeparator)) {
62-
if ldPath == "" || !path.IsAbs(ldPath) {
61+
if ldPath == "" || !filepath.IsAbs(ldPath) {
6362
// No empty or relative paths.
6463
continue
6564
}

pkg/pjrt/dynamiclib_posix.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ import "C"
4040
import (
4141
"bufio"
4242
"os"
43-
"path"
4443
"path/filepath"
4544
"regexp"
4645
"strings"
@@ -82,7 +81,7 @@ func osDefaultLibraryPaths() []string {
8281

8382
// Prefix LD_LIBRARY_PATH to non-absolute entries.
8483
for ldPath := range strings.SplitSeq(os.Getenv("LD_LIBRARY_PATH"), ":") {
85-
if ldPath == "" || !path.IsAbs(ldPath) {
84+
if ldPath == "" || !filepath.IsAbs(ldPath) {
8685
// No empty or relative paths.
8786
continue
8887
}

pkg/pjrt/plugins.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ func RegisterPreloadedPlugin(name string, api uintptr) error {
125125
// If it is not set it will search in `/usr/local/lib/gomlx` and the standard libraries directories of the
126126
// system (in linux in LD_LIBRARY_CONFIG and /etc/ld.so.conf file).
127127
func GetPlugin(name string) (*Plugin, error) {
128-
fmt.Printf("GetPlugin(%q):\n", name)
129128
return loadNamedPlugin(name)
130129
}
131130

0 commit comments

Comments
 (0)