Philio / GoMySQL

The most complete and stable MySQL client library written completely in Go. For discussion, ideas, suggestions, feature requests etc, please visit the GoMySQL Google Group (link below). For any issues/bugs or need some help, please post an issue on Github.
https://groups.google.com/group/gomysql
Other
189 stars 37 forks source link

GoMySQL doesn't play nice with goinstall #40

Open dadkins opened 13 years ago

dadkins commented 13 years ago

Everytime I update my Go installation, I am unable to build my programs which rely on GoMySQL, e.g.

$ make 6g -o go.6 warden.go scrape.go warden.go:22: can't find import: mysql make: *\ [go.6] Error 1

I think this problem occurs because GoMySQL installs it's target to $GOROOT/pkg/$GOOS-$GOARCH/mysql.a. The base library directory gets wiped out when running $GOROOT/src/all.bash.

I think the solution to this problem is to change the Makefile so that

TARG=githib.com/Philio/GoMySQL

and change any imports to

import "github.com/Philio/GoMySQL"

It's less visually pleasing than import "mysql", but it keeps my build from breaking every time I update the Go compiler, not to mention preventing name clashes with anyone else who might call their package "mysql".

diff --git a/Examples/query.go b/Examples/query.go
index b1e6c53..d623908 100644
--- a/Examples/query.go
+++ b/Examples/query.go
@@ -3,7 +3,7 @@
 package main

 import (
-       "mysql"
+       "github.com/Philio/GoMySQL"
        "fmt"
        "os"
        "flag"
diff --git a/Examples/reconnect.go b/Examples/reconnect.go
index a798e7b..3cef7d9 100644
--- a/Examples/reconnect.go
+++ b/Examples/reconnect.go
@@ -4,7 +4,7 @@
 package main

 import (
-       "mysql"
+       "github.com/Philio/GoMySQL"
        "fmt"
        "os"
        "time"
diff --git a/Examples/statement.go b/Examples/statement.go
index c5ab2a1..593407b 100644
--- a/Examples/statement.go
+++ b/Examples/statement.go
@@ -3,7 +3,7 @@
 package main

 import (
-       "mysql"
+       "github.com/Philio/GoMySQL"
        "fmt"
        "os"
        "flag"
diff --git a/Makefile b/Makefile
index 23488ae..dba4471 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 include $(GOROOT)/src/Make.inc

-TARG=mysql
+TARG=github.com/Philio/GoMySQL
 GOFILES=mysql.go mysql_const.go mysql_error.go mysql_packet.go mysql_result.go mysql_statement.go

 include $(GOROOT)/src/Make.pkg 
Philio commented 13 years ago

I'll look into this, it always used to work fine both ways but this using the "old" style makefile.